Skip to content

Commit 3e2f1cd

Browse files
committed
Add Ancestors (plural) method to GitInfo, rename Ancestor field to Parent
Fixes #13839
1 parent 0a5b870 commit 3e2f1cd

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

docs/content/en/methods/page/GitInfo.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,22 +117,22 @@ hugo --enableGitInfo
117117
{{ end }}
118118
```
119119

120-
###### Ancestor
120+
### Ancestors
121121

122-
(`*source.GitInfo`) The file-filtered ancestor commit, if any.
122+
(`*source.GitInfo`) The file-filtered ancestor commits, if any.
123123

124124
```go-html-template
125-
{{ partial "inline/changelog.html" .GitInfo }} → 2023-10-09: Add tutorials
126-
2025-03-26: Edit GitInfo docs
127-
128-
{{ define "_partials/inline/changelog.html" }}
129-
{{ with . }}
130-
{{ partial "inline/changelog.html" .Ancestor }}
131-
{{ .CommitDate.Format "2006-01-02" }}: {{ .Subject }}<br>
125+
{{ with .GitInfo }}
126+
{{ range .Ancestors | first 5 }}
127+
{{ .CommitDate.Format "2006-01-02" }}: {{ .Subject }}
132128
{{ end }}
133129
{{ end }}
134130
```
135131

132+
### Parent
133+
134+
(`*source.GitInfo`) The first file-filtered ancestor commit, if any.
135+
136136
## Last modified date
137137

138138
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.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/aws/aws-sdk-go-v2/service/cloudfront v1.44.10
99
github.com/bep/clocks v0.5.0
1010
github.com/bep/debounce v1.2.0
11-
github.com/bep/gitmap v1.7.0
11+
github.com/bep/gitmap v1.9.0
1212
github.com/bep/goat v0.5.0
1313
github.com/bep/godartsass/v2 v2.5.0
1414
github.com/bep/golibsass v1.2.0

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ github.com/bep/debounce v1.2.0 h1:wXds8Kq8qRfwAOpAxHrJDbCXgC5aHSzgQb/0gKsHQqo=
143143
github.com/bep/debounce v1.2.0/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0=
144144
github.com/bep/gitmap v1.7.0 h1:jvPnRQv5RG6IDPrwoDiwAhTE/DmdEkOW4poFeUYmjI8=
145145
github.com/bep/gitmap v1.7.0/go.mod h1:n+3W1f/rot2hynsqEGxGMErPRgT41n9CkGuzPvz9cIw=
146+
github.com/bep/gitmap v1.8.0 h1:j03jlizRRo+0c+XKoV4h6qj4g3L3tUAt/ReSaSRdRWw=
147+
github.com/bep/gitmap v1.8.0/go.mod h1:n+3W1f/rot2hynsqEGxGMErPRgT41n9CkGuzPvz9cIw=
148+
github.com/bep/gitmap v1.9.0 h1:2pyb1ex+cdwF6c4tsrhEgEKfyNfxE34d5K+s2sa9byc=
149+
github.com/bep/gitmap v1.9.0/go.mod h1:Juq6e1qqCRvc1W7nzgadPGI9IGV13ZncEebg5atj4Vo=
146150
github.com/bep/goat v0.5.0 h1:S8jLXHCVy/EHIoCY+btKkmcxcXFd34a0Q63/0D4TKeA=
147151
github.com/bep/goat v0.5.0/go.mod h1:Md9x7gRxiWKs85yHlVTvHQw9rg86Bm+Y4SuYE8CTH7c=
148152
github.com/bep/godartsass/v2 v2.5.0 h1:tKRvwVdyjCIr48qgtLa4gHEdtRkPF8H1OeEhJAEv7xg=

0 commit comments

Comments
 (0)