Skip to content

Commit 811ce36

Browse files
committed
Merge branch 'master' of github.com:zhaoterryy/mkdocs-git-revision-date-plugin
2 parents 55af76d + 2bd6bf2 commit 811ce36

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# mkdocs-git-revision-date-plugin
2+
3+
MkDocs plugin for setting revision date from git per markdown file.
4+
5+
## Setup
6+
Install the plugin using pip:
7+
8+
`pip install mkdocs-git-revision-date-plugin`
9+
10+
Activate the plugin in `mkdocs.yml`:
11+
```yaml
12+
plugins:
13+
- search
14+
- git-revision-date
15+
```
16+
17+
> **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.
18+
19+
More information about plugins in the [MkDocs documentation][mkdocs-plugins].
20+
21+
## Usage
22+
Use `page.meta.revision_date` in templates to access the revision date of the current page in ISO format *(YYYY-mm-dd)*.
23+
24+
## Example
25+
```django hljs
26+
{% block footer %}
27+
<hr>
28+
<p>{% if config.copyright %}
29+
<small>{{ config.copyright }}<br></small>
30+
{% endif %}
31+
<small>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</small>
32+
{% if page.meta.revision_date %}
33+
<small><br><i>Updated {{ page.meta.revision_date }}</i></small>
34+
{% endif %}
35+
</p>
36+
{% endblock %}
37+
```
38+
39+
More information about templates [here][mkdocs-template].
40+
41+
More information about blocks [here][mkdocs-block].
42+
43+
[mkdocs-plugins]: http://www.mkdocs.org/user-guide/plugins/
44+
[mkdocs-template]: https://www.mkdocs.org/user-guide/custom-themes/#template-variables
45+
[mkdocs-block]: https://www.mkdocs.org/user-guide/styling-your-docs/#overriding-template-blocks

0 commit comments

Comments
 (0)