-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Sitemaps: add lastmod
for individual posts and the homepage
#4901
Conversation
@pbiron Would love to get your review on this one |
@joemcgill Since you were involved with sitemaps originally, I would appreciate your eyes on this PR. tl;dr is that lastmod is useful for search engines, so when we can easily expose it (such as for posts and the homepage), we should, but it's also no big deal if it's missing (e.g. for term archives) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me.
It's been several years since I worked on the original proof of concept for this feature, but if memory serves, we initially included lastmod
values for these types of pages and ended up removing them for consistency, since some values are difficult to calculate in a performant way. At the time, the guidance we were getting was that these values were not being used as a significant signal by search engines, and extenders were able to filter these values to add lastmod
if needed. Here's the PR where the initial implementation was removed.
It's possible that some of those original ideas could be used to further extend the places where core makes lastmod available.
Thanks @joemcgill! That's how I remember it too. Now the guidance has slightly changed, and providing lastmod where easily possible is now preferrable. This PR will close the existing ticket, but a new one can be opened for lastmod elsewhere and whatever is required for that. |
Committed in https://core.trac.wordpress.org/changeset/56985 |
This resolves the most critical aspect of that Trac ticket for "Last modified".
What it does:
lastmod
to all individual post objects (of any post type) in the sitemap.lastmod
to the homepage sitemap entry if the homepage is set to display the latest posts.As per my comment, the latter is mostly nice to have but not critical. If we think this approximation is not good enough, we can omit it for now.
What it does not:
lastmod
is added for the individual sitemap pages in the sitemap indexlastmod
is added for term archives or user archivesThose are difficult to add without any proper mechanism to determine and cache last modified date. As per my comment, this should not be an issue.
Trac ticket: https://core.trac.wordpress.org/ticket/52099
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.