Skip to content
MkDocs plugin for setting revision date from git per markdown file
Python
Branch: master
Clone or download
Latest commit 5ceed50 May 30, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
mkdocs_git_revision_date_plugin feat: inject into markdown as variable Mar 6, 2019
.gitignore Initial commit Dec 3, 2018
README.md HTTPS links on README Jun 4, 2019
setup.py feat: inject into markdown as variable Mar 6, 2019

README.md

mkdocs-git-revision-date-plugin

MkDocs plugin for setting revision date from git per markdown file.

Setup

Install the plugin using pip:

pip install mkdocs-git-revision-date-plugin

Activate the plugin in mkdocs.yml:

plugins:
  - search
  - git-revision-date

Note: If you have no plugins entry in your config file yet, you'll likely also want to add the search plugin. MkDocs enables it by default if there is no plugins entry set, but now you have to enable it explicitly.

More information about plugins in the MkDocs documentation.

Usage

The revision date will be displayed in ISO format (YYYY-mm-dd).

Templates - page.meta.revision_date:

Example

{% block footer %}
<hr>
<p>{% if config.copyright %}
<small>{{ config.copyright }}<br></small>
{% endif %}
<small>Documentation built with <a href="https://www.mkdocs.org/">MkDocs</a>.</small>
{% if page.meta.revision_date %}
<small><br><i>Updated {{ page.meta.revision_date }}</i></small>
{% endif %}
</p>
{% endblock %}

More information about templates here.

More information about blocks here.

Markdown - {{ git_revision_date }}:

Example

Page last revised on: {{ git_revision_date }}

If using mkdocs_macro_plugin, it must be included after our plugin.

i.e., mkdocs.yml:

plugins:
  - search
  - git-revision-date
  - macros

Options

enabled_if_env

Setting this option will enable the build only if there is an environment variable set to 1. Default is not set.

modify_md

Setting this option to false will disable the use of {{ git_revision_date }} in markdown files. Default is true.

You can’t perform that action at this time.