2.0 KiB
Revision date
The mkdocs-git-revision-date-localized-plugin is an extension that shows
the date on which a Markdown file was last updated in at the bottom of each
page. The date is extracted at the time of the build, so mkdocs build
must be
triggered from within a git repository.
!!! success "Bundled with the official Docker image"
This plugin is already installed for your convenience when you use the
official [Docker image][2], so the installation step can be skipped. Read
the [getting started guide][3] to get up and running with Docker.
Installation
Install the plugin using pip
:
pip install mkdocs-git-revision-date-localized-plugin
Configuration
Add the following lines to mkdocs.yml
:
plugins:
- search # necessary for search to work
- git-revision-date-localized
Note that the date is printed according to the locale which is determined
through the theme language that was set in mkdocs.yml
.
Language
The language (i.e. locale) is deduced from the theme.language
option.
Format
Default:
date
To change the date format, set the type
parameter to one of date
,
datetime
, iso_date
, iso_datetime
or timeago
, e.g.:
plugins:
- search # necessary for search to work
- git-revision-date-localized:
type: date
The following formats are supported:
28 November, 2019 # type: date
28 November, 2019 13:57:28 # type: datetime
2019-11-28 # type: iso_date
2019-11-28 13:57:26 # type: iso_datetime
20 hours ago # type: timeago
Usage
When enabled, the respective date is automatically added at the bottom of each page, e.g.:
Last updated: 9 December, 2019