From 68620a6c289e73e48cd1674b26e597aa52402772 Mon Sep 17 00:00:00 2001 From: Jens Broekens Date: Wed, 26 Mar 2025 20:12:48 +0100 Subject: [PATCH] source: Expose Ancestor in GitInfo Also updates docs and bumps bep/gitmap to v1.7.0 Closes #5693 Co-authored-by: bep --- content/en/methods/page/GitInfo.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/content/en/methods/page/GitInfo.md b/content/en/methods/page/GitInfo.md index 5fde05b07..889682390 100644 --- a/content/en/methods/page/GitInfo.md +++ b/content/en/methods/page/GitInfo.md @@ -117,6 +117,22 @@ hugo --enableGitInfo {{ end }} ``` +###### Ancestor + +(`*source.GitInfo`) The file-filtered ancestor commit, if any. + +```go-html-template +{{ partial "inline/changelog.html" .GitInfo }} → 2023-10-09: Add tutorials + 2025-03-26: Edit GitInfo docs + +{{ define "_partials/inline/changelog.html" }} + {{ with . }} + {{ partial "inline/changelog.html" .Ancestor }} + {{ .CommitDate.Format "2006-01-02" }}: {{ .Subject }}
+ {{ end }} +{{ end }} +``` + ## Last modified date By default, when `enableGitInfo` is `true`, the `Lastmod` method on a `Page` object returns the Git AuthorDate of the last commit that included the file.