Closed hughbris closed 1 month ago
I was able to do it by editing user/plugins/sitemap/sitemap.xml:287
from:
'lastmod' => date($this->datetime_format, $page->modified()),
to
'lastmod' => date($this->datetime_format, $page->date() ?: $page->modified()),
@rhukster do you want to close this too due to #113?
I submitted a PR (#98) because I thought I'd solved this simply, but I got caught up in a conversation there that threw lots of doubt on my solution. I'm going to bring this back to what I want and the use cases.
The sitemap plugin uses the page object's
modified()
method to set itslastmod
property in the sitemap. This simply grabs the file modification date from the file system.I want to be able to set
lastmod
manually at page level, just as it's possible to setchangefreq
andpriority
per page in page frontmatter.Here are a few reasons/use cases:
.md
file has not been touched. For example, the page contains content sourced from a datasource, a modular child, or displays a gallery which changed.I thought a page's
date
frontmatter indicated a manually set modification date and we could simply use that, but I think it may be widely understood to be the page's creation date.Would it be less ambiguous and cleaner to simply allow setting
sitemap.lastmod
for each page?How best to achieve this?