timvink / mkdocs-git-revision-date-localized-plugin

MkDocs plugin to add a last updated date to your site pages
https://timvink.github.io/mkdocs-git-revision-date-localized-plugin/index.html
MIT License
206 stars 44 forks source link

Moving the revision date to be below the header #55

Closed leeyspaul closed 3 years ago

leeyspaul commented 3 years ago

I couldn't find reference material on how to move a revision date to be below the header instead of being at the footer to make it more obvious. Is there a way to do this without having to add it directly in markdown on every page?

Thanks for the great plugin!

timvink commented 3 years ago

Hi @leeyspaul ,

The layout is part of the theme you are using. The easiest way to customize the theme you are using is by using a theme override. I described how to do this for the mkdocs base theme and for mkdocs-material theme here: https://timvink.github.io/mkdocs-git-revision-date-localized-plugin/howto/override-a-theme/

Because mkdocs-material offers native support for this plugins, you'll have two edit two partials: source-date.html to remove the revision date from the current position, and another partial to insert the revision date where you would like to have it.

Let me know if the plugin docs can be important / if anything is unclear.

leeyspaul commented 3 years ago

ok, thanks for the quick response! I'll take a look and come back around if I can't figure it out

leeyspaul commented 3 years ago

Hey @timvink I took a look and I got blocked on trying to get the date to show under an h1 tag. Right now base.html https://github.com/squidfunk/mkdocs-material/blob/05d3c1399f53b7e5d98c8231c98ff63ff0bf5987/material/base.html renders the {{ page.content }} and I'm not sure how to access the h1 to inject the date here. I think I'm overcomplicating things as I'm not too familiar with the way jinja works.

Do I have to modify the Python pages code to do this? https://github.com/mkdocs/mkdocs/blob/master/mkdocs/structure/pages.py

timvink commented 3 years ago

Changing the layout of a theme is outside the scope of this plugin, so I'm closing the issue.

That said, a quick look and probably you can edit the page title with this block here:

https://github.com/squidfunk/mkdocs-material/blob/05d3c1399f53b7e5d98c8231c98ff63ff0bf5987/material/base.html#L163-L165