diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-07-01 15:49:26 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-07-01 21:48:12 +0200 |
commit | 7b6dafc53a21295e10c2bbc893bf265ea0dd2b22 (patch) | |
tree | 7d6352e21ab76cb88ad711ae4c272ebdecb8d22b /resources | |
parent | 932ab4c058bf7a36e55d0f607b5a237f90a25405 (diff) | |
download | hugo-7b6dafc53a21295e10c2bbc893bf265ea0dd2b22.tar.gz hugo-7b6dafc53a21295e10c2bbc893bf265ea0dd2b22.zip |
Fix it so publishDate rolls up to section, taxonomy, or term pages
Fixes #12438
Diffstat (limited to 'resources')
-rw-r--r-- | resources/page/pagemeta/page_frontmatter.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/resources/page/pagemeta/page_frontmatter.go b/resources/page/pagemeta/page_frontmatter.go index c901ab57b..0e0650934 100644 --- a/resources/page/pagemeta/page_frontmatter.go +++ b/resources/page/pagemeta/page_frontmatter.go @@ -57,13 +57,17 @@ func (d Dates) IsDateOrLastModAfter(in Dates) bool { return d.Date.After(in.Date) || d.Lastmod.After(in.Lastmod) } -func (d *Dates) UpdateDateAndLastmodIfAfter(in Dates) { +func (d *Dates) UpdateDateAndLastmodAndPublishDateIfAfter(in Dates) { if in.Date.After(d.Date) { d.Date = in.Date } if in.Lastmod.After(d.Lastmod) { d.Lastmod = in.Lastmod } + + if in.PublishDate.After(d.PublishDate) && in.PublishDate.Before(htime.Now()) { + d.PublishDate = in.PublishDate + } } func (d Dates) IsAllDatesZero() bool { |