This is a simple MkDocs plugin that just gets the
most recent Tag
from the local Git repository and makes it available as a
markdown tag in the template.
The idea behind this is that GitHub uses the Tag
to name the release and,
therefore we can use it to display the version of the documentation that
corresponds to the release.
The Tag is just returned as a string with no formatting applied. If none is found, it returns "No Tags found"
There is a Demo Site
Install the package with pip:
pip install mkdocs-latest-git-tag-plugin
or, if you are using Poetry:
poetry add mkdocs-latest-git-tag-plugin --group dev
Activate the plugin in your mkdocs.yml
:
plugins:
- latest-git-tag
If you have no
plugins
entry in your config file yet, you'll likely also want to add thesearch
plugin. MkDocs enables it by default if here is noplugins
entry set.
Then, in your template, you can use the {{ latest_git_tag }}
variable:
# My Project
Version: {{ latest_git_tag }}
The spaces around the tag are optional and it is case insensitive.
At this time there are no configuration options.
This is released under the MIT License. See the bundled LICENSE file for more details.
- Add tests