MkDocs Git Revision Date Localized Plugin
This MkDocs plugin enables displaying the localized date of the last Git modification (and creation) of a Markdown file directly in your documentation. It is currently at version 1.5.1 and maintains an active release cadence with regular minor and patch updates.
Warnings
- breaking Python 3.8 and 3.9 are no longer supported as of version 1.5.0. Users on these Python versions should upgrade to Python 3.10 or newer, or pin the plugin version to <1.5.0.
- breaking As of version 1.3.0, the plugin changed how it calculates revision dates by ignoring whitespace-only and blank line changes, as well as rename commits. This may lead to different (and often more accurate) revision dates than in previous versions.
- gotcha The plugin relies heavily on the `git` command-line tool. Ensure `git` is installed and accessible in your system's PATH, especially when building documentation in Docker containers (e.g., Alpine Linux may require explicit Git installation).
- gotcha Users working with monorepos might encounter issues with revision date accuracy due to the plugin's reliance on Git operations relative to the repository root. While multiple fixes have been applied (e.g., in v1.4.1, v1.4.5, v1.5.0), complex monorepo setups can still be challenging.
Install
-
pip install mkdocs-git-revision-date-localized-plugin
Imports
- Plugin
This plugin is configured in mkdocs.yml, not imported directly in Python code.
Quickstart
# mkdocs.yml
site_name: My Awesome Docs
plugins:
- git-revision-date-localized:
enable_creation_date: true
locale: en
timezone: Europe/Berlin
# --- Create docs/index.md for testing ---
# In your project root, create a 'docs' directory:
# mkdir -p docs
# echo '# Welcome\n\nLast updated: {{ git_revision_date_localized }}\nCreated: {{ git_creation_date_localized }}' > docs/index.md
# --- Build and serve ---
# mkdocs build
# mkdocs serve