mgeier / sphinx-last-updated-by-git

:watch: Get the "last updated" time for each Sphinx page from Git
BSD 2-Clause "Simplified" License
44 stars 9 forks source link
sphinx-doc sphinx-extension

Get the "last updated" time for each Sphinx page from Git

This is a little Sphinx_ extension that does exactly that. It also checks for included files and other dependencies and uses their "last updated" time if it's more recent. For each file, the "author date" of the Git commit where it was last changed is taken to be its "last updated" time. Uncommitted changes are ignored.

If a page doesn't have a source file, its lastupdated time is set to None.

The default value for html_last_updatedfmt is changed from None to the empty string.

Usage

. Install the Python package sphinx-last-updated-by-git

#. Add ``'sphinx_last_updated_by_git'`` to ``extensions`` in your ``conf.py``
#. Run Sphinx!

Options

Caveats

License BSD-2-Clause (same as Sphinx itself), for more information take a look at the LICENSE file.

Similar stuff | https://github.com/jdillard/sphinx-gitstamp | https://github.com/OddBloke/sphinx-git | https://github.com/MestreLion/git-tools (git-restore-mtime) | https://github.com/TYPO3-Documentation/sphinxcontrib-gitloginfo

.. _Sphinx: https://www.sphinx-doc.org/ .. _last_updated: https://www.sphinx-doc.org/en/master/ templating.html#last_updated .. _exclude_patterns: https://www.sphinx-doc.org/en/master/usage/ configuration.html#confval-exclude_patterns .. _autosummary_generate: https://www.sphinx-doc.org/en/master/ usage/extensions/autosummary.html#confval-autosummary_generate .. _html_copy_source: https://www.sphinx-doc.org/en/master/ usage/configuration.html#confval-html_copy_source .. _html_show_sourcelink: https://www.sphinx-doc.org/en/master/ usage/configuration.html#confval-html_show_sourcelink .. _html_last_updated_fmt: https://www.sphinx-doc.org/en/master/ usage/configuration.html#confval-html_last_updated_fmt .. _datetime.timezone: https://docs.python.org/3/library/ datetime.html#timezone-objects .. _babel: https://babel.pocoo.org/ .. _feature flag: https://docs.readthedocs.io/en/latest/ guides/feature-flags.html .. _issue #1: https://github.com/mgeier/sphinx-last-updated-by-git/issues/1 .. _issue #40: https://github.com/mgeier/sphinx-last-updated-by-git/issues/40