Giter Site home page Giter Site logo

Comments (5)

bep avatar bep commented on July 23, 2024

See #12438

from hugo.

willfaught avatar willfaught commented on July 23, 2024

@bep It seems that you didn't read this issue. I linked to #12438 in it. What are your thoughts on the points I made in this issue?

from hugo.

willfaught avatar willfaught commented on July 23, 2024

@bep Also, if the ultimate decision is to not revert the .PublishDate behavior, then we should follow through and fix the .PublishDate documentation to reflect the current behavior:

With Hugo’s default configuration, the PublishDate method returns the front matter value. This behavior is configurable, allowing you to set fallback values if the publish date is not defined in front matter.

from hugo.

bep avatar bep commented on July 23, 2024

With Hugo’s default configuration, the PublishDate method returns the front matter value. This behavior is configurable, allowing you to set fallback values if the publish date is not defined in front matter.

The above is still correct. If you add publishDate to front matter in e.g. mysection/_index.md then that is the value that's getting published.

The current behaviour matches how we treat both date and lastMod and is what most people would expect.

If you don't want to show publishDate for sections, then you can do a {{ if .IsPage }}{{ .PublishDate }}{{ end }} or something..

from hugo.

willfaught avatar willfaught commented on July 23, 2024

The above is still correct.

But it's incorrect if no date-like params are set. For other page kinds, if no date-like params are set, then .PublishDate is time.Time{}. That isn't the case for list pages. This special list page behavior is unspecified here and elsewhere.

If you don't want to show publishDate for sections, then you can do a {{ if .IsPage }}{{ .PublishDate }}{{ end }} or something.

I do want to show it if a date-like param is set, according to the configured fallbacks. As I pointed out above, there's currently no portable way to do this.

The current behaviour matches how we treat both date and lastMod

Then my argument should apply to them too. That does admittedly increase the scope of change. If you don't want to make breaking changes (again) like that, then I understand, but then how about a new field that implements the previous behavior? Something like PAGE.PublishDateNotRecursive (similar to PAGE.RegularPagesRecursive)?

(Edited)

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.