HUGO

Hash of last commit of any file

Dear All,

I would like to put the abbreviated hash of the last commit into my footer. By this I mean the last commit of ANY file, not the footer partial. Is there a way to do this?

As far as I understand .GitInfo looks up the commit info of the specific file it is in.

You need to separate “file” and “page”. .GitInfo looks up the information of the current page. Which is either empty on listpages without an _index.md or the hash of that _index.md (I might be wrong in this distinction) or it’s the hash of that single page. So you should be good to go even if you want to add the hash to the footer.

Get the last Git revision information for every -->content<-- file.

This may give you some inspiration:

=> https://gohugo.io/maintenance/

That said, “any file” is currently stretching it, but I have been wanting to make this into a function that could work on any file and also work well for themes/modules. But time.

You are right, and I didnt get that right away. Thanks for the heads up :slight_smile:

Get the last Git revision information for every -->content<-- file.

That is probably the way to go!

Thanks bep! This looks very useful. In fact I might just make a similar overview page for maintaneance reasons.