mkdocs-material/docs/plugins/revision-date.md

79 lines
2.0 KiB
Markdown
Raw Normal View History

# Revision date
2020-03-10 01:12:10 +03:00
The [mkdocs-git-revision-date-localized-plugin][1] 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.
[1]: https://github.com/timvink/mkdocs-git-revision-date-localized-plugin
2020-03-10 01:12:10 +03:00
[2]: https://hub.docker.com/r/squidfunk/mkdocs-material/
[3]: ../getting-started.md#with-docker-recommended
## Installation
2020-03-10 01:12:10 +03:00
Install the plugin using `pip`:
``` sh
pip install mkdocs-git-revision-date-localized-plugin
```
2020-03-10 01:12:10 +03:00
## Configuration
Add the following lines to `mkdocs.yml`:
``` yaml
plugins:
2020-03-10 01:12:10 +03:00
- search # necessary for search to work
- git-revision-date-localized
```
2020-03-10 01:12:10 +03:00
Note that the date is printed according to the locale which is determined
through the [theme language][2] that was set in `mkdocs.yml`.
2020-03-10 01:12:10 +03:00
[2]: ../getting-started.md/#language
2020-03-10 01:12:10 +03:00
### Language
2020-03-10 01:12:10 +03:00
The language (i.e. locale) is deduced from the `theme.language` option.
2020-03-10 01:12:10 +03:00
### Format
2020-03-10 01:12:10 +03:00
> Default: `date`
To change the date format, set the `type` parameter to one of `date`,
2020-03-10 01:12:10 +03:00
`datetime`, `iso_date`, `iso_datetime` or `timeago`, e.g.:
``` yaml
plugins:
2020-03-10 01:12:10 +03:00
- search # necessary for search to work
- git-revision-date-localized:
2020-03-10 01:12:10 +03:00
type: date
```
2020-03-10 01:12:10 +03:00
The following formats are supported:
2020-03-10 01:12:10 +03:00
``` gnuplot
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
```
2020-03-10 01:12:10 +03:00
## Usage
When enabled, the respective date is automatically added at the bottom of each
page, e.g.:
---
<small>
Last updated: 9 December, 2019
</small>