If...
- you are using the default meaning of
date
and publishDate
(see below),
- both are defined for a page,
- and
date
is different from publishDate
Then...
publishDate
is used to determine if a page is in the future (i.e. if hugo's -F
or --buildFuture
flag is required for the page to be built)
date
is used to order pages in the default ordering (Weight > Date > LinkTitle > Title > FilePath).[*] The default order is used in next/previous navigation and can be used in a range
.
Configuring dates is discussed in https://gohugo.io/getting-started/configuration/#configure-front-matter. Here is the default for date
and publishDate
:
frontmatter:
date:
- date
- publishDate
- lastmod
publishDate:
- publishDate
- date
Because I want date
and publishDate
to mean the same thing, I have the following in my config.yaml
:
frontmatter:
date:
- publishDate
- :filename
- date
- :fileModTime
publishDate:
- publishDate
- :filename
- date
- :fileModTime
I've made them the same because I, too, was puzzled by their difference!
[*] Info about ordering content in Hugo is at https://gohugo.io/templates/lists/#order-content
.PublishDate
returns.Date
when it is not explicitly specified.