From 4e71546d1936bd3ff93c4b65e9fd71802e795608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 7 Jul 2025 20:20:42 +0200 Subject: [PATCH] Add Ancestors (plural) method to GitInfo, rename Ancestor field to Parent Fixes #13839 --- content/en/methods/page/GitInfo.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/content/en/methods/page/GitInfo.md b/content/en/methods/page/GitInfo.md index 889682390..90dc3870a 100644 --- a/content/en/methods/page/GitInfo.md +++ b/content/en/methods/page/GitInfo.md @@ -117,22 +117,22 @@ hugo --enableGitInfo {{ end }} ``` -###### Ancestor +### Ancestors -(`*source.GitInfo`) The file-filtered ancestor commit, if any. +(`*source.GitInfo`) The file-filtered ancestor commits, 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 }}
+{{ with .GitInfo }} + {{ range .Ancestors | first 5 }} + {{ .CommitDate.Format "2006-01-02" }}: {{ .Subject }} {{ end }} {{ end }} ``` +### Parent + +(`*source.GitInfo`) The first file-filtered ancestor commit, if any. + ## 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.