Coder Social home page Coder Social logo

Comments (3)

jmooring avatar jmooring commented on June 10, 2024 1

@schu

The version string was added to the generator tag in v0.125.0 to address #11692, and was removed in v0.125.3 to address #12300 (comment). We should have closed #11692 as "won't fix".

I'll look into the zero pubdate problem.

from hugo.

jmooring avatar jmooring commented on June 10, 2024

The Date and Lastmod roll-up to section, taxonomy, and term pages. The PublishDate does not "roll-up".

I think the PublishDate should roll-up to the latest date before now(). If we rolled-up dates after now(), that would cause the section, taxonomy, or term page to not be published even if there's other descendant content.

Applicable to:

  • Automatic section, taxonomy, and term pages
  • Section, taxonomy, and term pages without Date and PublishDate

This isn't something new (i.e., same behavior in v0.122.0).

The test case below does not test for what should happen with publish dates greater than now() as described above.

Failing test
func TestFoo(t *testing.T) {
	t.Parallel()

	files := `
-- hugo.toml --
disableKinds = ['home','rss','sitemap']
[taxonomies]
tag = 'tags'
-- layouts/_default/list.html --
Date: {{ .Date.Format "2006-01-02" }}
PublishDate: {{ .PublishDate.Format "2006-01-02" }}
Lastmod: {{ .Lastmod.Format "2006-01-02" }}
-- layouts/_default/single.html --
{{ .Title }}
-- content/s1/p1.md --
---
title: p1
date: 2024-03-01
lastmod: 2024-03-02
tags: [t1]
---
-- content/s1/p2.md --
---
title: p2
date: 2024-04-03
lastmod: 2024-04-04
tags: [t1]
---
`

	// Test without publishDate in front matter.
	b := hugolib.Test(t, files)

	b.AssertFileContent("public/s1/index.html", `
		Date: 2024-04-03
		PublishDate: 2024-04-03
		Lastmod: 2024-04-04
	`)

	b.AssertFileContent("public/tags/index.html", `
		Date: 2024-04-03
		PublishDate: 2024-04-03
		Lastmod: 2024-04-04
	`)

	b.AssertFileContent("public/tags/t1/index.html", `
		Date: 2024-04-03
		PublishDate: 2024-04-03
		Lastmod: 2024-04-04
	`)

	// Test with publishDate in front matter.
	files = strings.ReplaceAll(files, "lastmod", "publishDate")

	b = hugolib.Test(t, files)

	b.AssertFileContent("public/s1/index.html", `
		Date: 2024-04-03
		PublishDate: 2024-04-03
		Lastmod: 2024-04-03
	`)

	b.AssertFileContent("public/tags/index.html", `
		Date: 2024-04-03
		PublishDate: 2024-04-03
		Lastmod: 2024-04-03
	`)

	b.AssertFileContent("public/tags/t1/index.html", `
		Date: 2024-04-03
		PublishDate: 2024-04-03
		Lastmod: 2024-04-03
	`)
}

from hugo.

bep avatar bep commented on June 10, 2024

I think the PublishDate should roll-up to the latest date before now().

Yea, that sounds reasonable.

from hugo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.