the “date” value represents the document’s creation date; and
“publishDate” represents the date the document is published,
then “publishDate” (publish) must be either equal to or after “date” (creation) - certainly it can’t predate it.
So when looking to fulfil “lastmod” (when document was last modified), it is illogical to first check for a creation date before checking for a publish date - it results in error where the publish date is different from the creation date.
It should first check to see if a date was supplied for the publish date and then, if none were provided, check to see if a date was provided for the creation date.
Have I perhaps misunderstood the semantic value of “date”?
I create documents that have a date, as they are text files that I just made. But sometimes the content is from the past, and was published before I made the text file, and so have a publishDate predating the date.
Oh, that sounds serious. What is the error? We should probably fix it so it doesn’t break out of the box.
Going by those definitions, and in the absence of another explanation, then I’ll assume the order is wrong.
More to the point, here is an example of common and expected use case where an error would result:
A post is created on 1 Dec 2020;
The publish date is set as 25 December 2020;
After 25 December 2020 and when the post is published and as a page live on the site:
3.1 the sitemap will incorrectly list the url’s lastmod date as 1 December 2020 (absent one of the other dates); and
3.2 if the post contains a conditional lastmod field in the template for “Post Last Updated”, then that will also incorrectly list 1 December 2020.
Note that “publishDate”'s definition very clearly contemplates it being used in this way with the future flag - not the way you are using it.
As to your particular use case you’ve cited in support of the opposite, I would say it would be more consistent with Hugo’s contemplated date system to overwrite “date” with the earlier creation date as “date”, and ten set “publishDate” as the date you publish it.
At the end of the day, it can be correct by setting the order in config anyway.
You’ve got a lot going on there, so I’ll just say: I was responding to “certainly it can’t predate it” portion. I wasn’t arguing or describing how it works. Good luck.
So I think my queries have been mistaken as “attacks” - which is not how I meant them to come across. I genuinely don’t understand the rationale for the order.
That said, I’ll drop it and just change it in my configuration for my case.
Otherwise, let me say thank you @bep and @maiki for doing a great job maintaining the project and contributing on the forum - keep up the good work.
the datetime at which the content was created; note this value is auto-populated according to Hugo’s built-in archetype.
Maybe the Front Matter documentation page could be updated so it says something like this:
date
One of the datetimes associated with the page. Its main use is for sorting pages, for example, in lists and Next/Previous navigation. See also expiryDate, lastmod, and publishDate. It used to be a required front-matter variable, but as of Hugo v??? it no longer needs to be specified in a page’s front matter.