Skip to content

[BUGFIX] Use last modification of all news records in sitemap index - #2856

Open
derhansen wants to merge 1 commit into
georgringer:mainfrom
derhansen:main
Open

derhansen wants to merge 1 commit into
georgringer:mainfrom
derhansen:main

Conversation

@derhansen

Copy link
Copy Markdown
Contributor

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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NewsXmlSitemapDataProvider shows wrong "Last modified" date in a paginated sitemap index

1 participant