Fix it so publishDate rolls up to section, taxonomy, or term pages

Fixes #12438
This commit is contained in:
Bjørn Erik Pedersen
2024-07-01 15:49:26 +02:00
parent 932ab4c058
commit 7b6dafc53a
3 changed files with 90 additions and 3 deletions

View File

@@ -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 {