How to get GitInfo for any file in a project (in a very hacky way)

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.

      - source: file.txt
        target: content/shame/

I also created a shame/ file to make sure it never gets placed in the output:

headless: true
    draft: false
       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.