]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
Add Ancestors (plural) method to GitInfo, rename Ancestor field to Parent
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 7 Jul 2025 18:20:42 +0000 (20:20 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 8 Jul 2025 13:08:09 +0000 (15:08 +0200)
Fixes #13839

docs/content/en/methods/page/GitInfo.md
go.mod
go.sum

index 8896823900889bf2b7de25d6c6a7ea65ed282b57..90dc3870a0ab7730efa1386a065f3f2df0398287 100644 (file)
@@ -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 }}<br>
+{{ 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.
diff --git a/go.mod b/go.mod
index f6a0c7eea9157002373d53118bc7a3079aa96a13..999c5a5138477d2dfced1cecb099833620b48d20 100644 (file)
--- a/go.mod
+++ b/go.mod
@@ -8,7 +8,7 @@ require (
        github.com/aws/aws-sdk-go-v2/service/cloudfront v1.44.10
        github.com/bep/clocks v0.5.0
        github.com/bep/debounce v1.2.0
-       github.com/bep/gitmap v1.7.0
+       github.com/bep/gitmap v1.9.0
        github.com/bep/goat v0.5.0
        github.com/bep/godartsass/v2 v2.5.0
        github.com/bep/golibsass v1.2.0
diff --git a/go.sum b/go.sum
index ed9d1ad4aba72883ad4374834ecf8cd60d8b2d9c..c6363174dd638b7267ae1492edb89b8791eaaacc 100644 (file)
--- a/go.sum
+++ b/go.sum
@@ -143,6 +143,10 @@ github.com/bep/debounce v1.2.0 h1:wXds8Kq8qRfwAOpAxHrJDbCXgC5aHSzgQb/0gKsHQqo=
 github.com/bep/debounce v1.2.0/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0=
 github.com/bep/gitmap v1.7.0 h1:jvPnRQv5RG6IDPrwoDiwAhTE/DmdEkOW4poFeUYmjI8=
 github.com/bep/gitmap v1.7.0/go.mod h1:n+3W1f/rot2hynsqEGxGMErPRgT41n9CkGuzPvz9cIw=
+github.com/bep/gitmap v1.8.0 h1:j03jlizRRo+0c+XKoV4h6qj4g3L3tUAt/ReSaSRdRWw=
+github.com/bep/gitmap v1.8.0/go.mod h1:n+3W1f/rot2hynsqEGxGMErPRgT41n9CkGuzPvz9cIw=
+github.com/bep/gitmap v1.9.0 h1:2pyb1ex+cdwF6c4tsrhEgEKfyNfxE34d5K+s2sa9byc=
+github.com/bep/gitmap v1.9.0/go.mod h1:Juq6e1qqCRvc1W7nzgadPGI9IGV13ZncEebg5atj4Vo=
 github.com/bep/goat v0.5.0 h1:S8jLXHCVy/EHIoCY+btKkmcxcXFd34a0Q63/0D4TKeA=
 github.com/bep/goat v0.5.0/go.mod h1:Md9x7gRxiWKs85yHlVTvHQw9rg86Bm+Y4SuYE8CTH7c=
 github.com/bep/godartsass/v2 v2.5.0 h1:tKRvwVdyjCIr48qgtLa4gHEdtRkPF8H1OeEhJAEv7xg=