Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Move last modified date on policy pages to front matter #544

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

carrythebanner
Copy link
Collaborator

WIP solution to #532.

Ideally the last modified date would be set automatically, and supposedly this is possible — see https://gohugo.io/methods/page/lastmod/. (Requires enableGitInfo to be enabled in the site config, which it is.) However, I experimented with this for a while, and on my local at least, I was always stuck with a mod date of "January 1, 0001." See also https://makewithhugo.com/add-a-last-edited-date/.

This approach in this PR does work, but it's is a little fiddly and just as manual as adding it to the content itself. But, maybe it has the bones of the real solution.

@carrythebanner carrythebanner changed the title WIP move last modified date on policy pages to front matter [WIP] Move last modified date on policy pages to front matter Dec 28, 2023
</div>

<div class="lastmod">
<!-- Last updated: {{ .Lastmod | time.Format ":date_medium" }} -->
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO remove commented-out troubleshooting code

@carrythebanner
Copy link
Collaborator Author

carrythebanner commented Feb 27, 2024

Moved enableGitInfo = true to the top level of the config.toml file, but when I do I get this error:

ERROR 2024/02/27 06:48:43 Failed to read Git log: fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

(So, that line is commented out in the latest commit, but hoping to resolve that once I get a chance to look into the above.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant