Repository navigation
Conversation
The sitemap index shows a lastmod date for every sub-sitemap. The NewsXmlSitemapDataProvider only loads the records of the requested sitemap page, and the inherited getLastModified() finds the newest timestamp among those loaded items only. For the index, the provider is created without a page parameter, so every sub-sitemap gets the lastmod of the first page's records. Changes to news records on later pages never show up in the index, and search engines may not crawl those sub-sitemaps again. The provider now finds the newest value of the configured lastModifiedField across all matching news records with a separate MAX() query and returns it from getLastModified(). A new getQueryBuilder() method builds the query that the count, the last-modification and the page queries all share. The recursive page lookup now runs only once. Resolves: georgringer#2844
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The sitemap index shows a lastmod date for every sub-sitemap. The NewsXmlSitemapDataProvider only loads the records of the requested sitemap page, and the inherited getLastModified() finds the newest timestamp among those loaded items only. For the index, the provider is created without a page parameter, so every sub-sitemap gets the lastmod of the first page's records. Changes to news records on later pages never show up in the index, and search engines may not crawl those sub-sitemaps again.
The provider now finds the newest value of the configured lastModifiedField across all matching news records with a separate MAX() query and returns it from getLastModified(). A new getQueryBuilder() method builds the query that the count, the last-modification and the page queries all share. The recursive page lookup now runs only once.
Resolves: #2844