Closed smholvoet closed 1 year ago
Welcome to this project and thank you!' first issue
For the first part: yes, the macro git.date
refers to the last commit for the whole repo. Getting the commit date for a specific page is non-trivial (one needs to formulate the exact path: git log -1 --format="%ad" -- path/to/file
). My best suggestion, at the moment, would be to write a specific macro for it.
For the second question, it is important to remember that the jinja2 engine for macros is not the same as for the override of templates. To makes things clear, the jinja2 engine for templates is strictly for HTML, whole the macros jinja2 engine works with markdown (HTML allowed).
I'm trying to make use of the Git info plugin, but I keep getting the latest commit of the entire repo instead of the latest commit of that specific page.
Last modified {{ git.date.strftime("%B %d, %Y at %H:%M %Z") }}: [{{ git.message }} (
{{ git.short_commit }})](https://dev.azure.com/org/project/_git/repo/commit/{{ git.commit }})
Version I'm using:
On a sidenote, I'd like to display this info by default on every page. I'm trying to use an override block to do this which ends up in a mkdocs build error:
overrides/main.html
:Results in
jinja2.exceptions.UndefinedError: 'git' is undefined
I now have the shortcodes (at the top of this issue) at the bottom of every Markdown page.