-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate the four predefined front matter date fields when type is string #10717
Comments
I agree that it would be helpful if the 4 front matter date fields were validated for JSON and YAML. With these formats, any date that you provide is a string---there is not a native date type. When using TOML, where dates are a native type, github.com/pelletier/go-toml throws an error when an unquoted value looks like a date but isn't a date. The native date type provided by TOML is very useful when performing date comparisons involving custom date parameters in front matter. |
Perhaps it does generate the page, but sorts it into the wrong location, with 100s of posts and a pagination on the main page, it's likely not to be found. |
As I showed in my previous comment, the page gets generated but the date becomes "Monday, Jan 1, 0001". |
It's also possible that the date is interpreted as being in the future, and in that case, no page is generated. |
The fix/change that went into 0.135.0 to "validate predefined font matter" dates appears to have broken when using a standard dates: From .md file Error: |
Hugo is doing what it should be doing... it's throwing an error because "September 29, 2024" cannot be cast into a time.Time value. Instead of throwing an error, prior versions silently interpreted your example to be the zero date ( Here are some examples of valid, parsable date strings: This issue is closed. Please use the forum (https://discourse.gohugo.io/) if you have additional questions. Thanks. |
with hugo v0.110.0+extended darwin/arm64 BuildDate=unknown from brew
With the following front matter on a page in index.md
Note the extra zero in the day portion of the date.
The page will not be generated andno error message will be issued. I would expect an error message about an unparsable date.The text was updated successfully, but these errors were encountered: