#mdbook #git-commit #add #last #date #page #change

bin+lib mdbook-last-changed

mdbook preprocessor to add the last modification date per page

5 releases

0.1.4 Aug 5, 2023
0.1.3 Jul 11, 2023
0.1.2 Dec 18, 2022
0.1.1 Nov 1, 2022
0.1.0 Nov 1, 2022

#999 in Text processing

Download history 8/week @ 2024-01-24 22/week @ 2024-01-31 19/week @ 2024-02-07 47/week @ 2024-02-14 47/week @ 2024-02-21 45/week @ 2024-02-28 55/week @ 2024-03-06 63/week @ 2024-03-13 40/week @ 2024-03-20 10/week @ 2024-03-27 31/week @ 2024-04-03 30/week @ 2024-04-10 64/week @ 2024-04-17 48/week @ 2024-04-24 19/week @ 2024-05-01 106/week @ 2024-05-08

238 downloads per month

MPL-2.0 license

184 lines


A preprocessor for mdbook to add a page's last change date and a link to the commit on every page.

It adds a "Last change" footer, including a date and a link to the corresponding commit. It uses the configured git-repository-url as the base.


  • The git command line tool.
  • Access to the git repository checkout while building your book.


If you want to use only this preprocessor, install the tool:

cargo install mdbook-last-changed

Add it as a preprocessor to your book.toml:

command = "mdbook-last-changed"
renderer = ["html"]


mdbook-last-changed is configured using additional options under [output.html]:

# Optional: Your repository URL used in the link.
git-repository-url = "https://github.com/$user/$project"

If git-repository-url is not configured the footer will not contain the commit and a link to it and instead only show the last changed date.

Without git-repository-url configured:

<footer id="last-change">Last change: 2023-07-09</footer>

With git-repository-url configured:

<footer id="last-change">Last change: 2023-07-09, commit: <a href="https://github.com/$user/$project/commit/$commit">0000000</a></footer>

To style the footer add a custom CSS file for your HTML output:

additional-css = ["last-changed.css"]

And in last-changed.css style the <footer> element or directly the CSS element id last-changed:

footer {
  font-size: 0.8em;
  text-align: center;
  border-top: 1px solid black;
  padding: 5px 0;

This code block shrinks the text size, center-aligns it under the rest of the content and adds a small horizontal bar above the text to separate it from the page content.

Finally, build your book as normal:

mdbook path/to/book


Copyright (c) 2022 Jan-Erik Rediger janerik@fnordig.de


~342K SLoC