gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
76.03k stars 7.54k forks source link

published front matter no longer supports boolean #13073

Closed domo84 closed 1 day ago

domo84 commented 1 day ago

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.139.0-dacef0df92a9a20072b4eaa42003e1a63ace8f41+extended linux/amd64 BuildDate=2024-11-18T16:17:45Z VendorInfo=gohugoio

Does this issue reproduce with the latest release?

Yes.

The published front matter attribute no longer supports published: false. It results in the following error:

ERROR the "published" front matter field is not a parsable date: see /path/to/sites/hugo-test-published/content/index.html

As far as I can see this error was introduced in v0.135.0 when Hugo started enforcing proper date strings. And since published being an alias of publishDate this is probably an unintended consequence..

Expected and previous behavior was that Hugo didn't published the page if it was set to false. A way for editors to toggle page visibility.

jmooring commented 1 day ago

The idiomatic way to toggle page visibility is by using the draft front matter field.

Controlling page visibility by setting the publication date to false was never documented; the fact that it did what you want is a bit of a happy accident.

We're not going to revert the behavior, so you can either:

  1. Use the draft field
  2. Move the published field under the params key and then filter your page collections
bep commented 1 day ago

You can also remove published from the lists here:

https://gohugo.io/getting-started/configuration/#configure-dates

domo84 commented 1 day ago

the fact that it did what you want is a bit of a happy accident.

Oh, I see! Been using it for years on many sites. In fact the GUI we're using for content management also uses it. Using draft instead from here on seems like the way go.

domo84 commented 1 day ago

You can also remove published from the lists here:

https://gohugo.io/getting-started/configuration/#configure-dates

Awesome!

Thanks for the speedy responses guys!