I’m making a site where I need to post the most recent update for something. While .GitInfo is there, it only works for pages in content directories.
To get around this, I mapped the file I wanted the GitInfo for to the content directory.
module:
mounts:
- source: file.txt
target: content/shame/file.md
I also created a shame/_index.md file to make sure it never gets placed in the output:
---
headless: true
cascade:
draft: false
_build:
render: false
list: false
---
I can then reference the page via site.GetPage and access GitInfo from there.
Not the proudest code I’ve written but it works.