Repository navigation
fix(sitemap): stop stamping every URL with a made-up lastmod - #16
Merged
Merged
Conversation
The deco sitemap wrote today's date on every <url>, and the VTEX sitemaps come stamped with their generation date. Neither says when a page changed, and crawlers that notice ignore lastmod for the whole site, including sitemaps that carry real dates. - website/handlers/sitemap.ts: no longer writes <lastmod>. - vtex/handlers/sitemap.ts: new opt-in removeUrlLastmod prop drops the <lastmod> of every <url> in the proxied sitemaps, leaving the <sitemap> blocks of the index alone. Wired through vtex/loaders/proxy.ts.
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.
What
website/handlers/sitemap.ts(the deco sitemap) no longer writes<lastmod>. It used today's date on every URL.vtex/handlers/sitemap.tsgets an opt-inremoveUrlLastmodprop. When it is on, the prop drops the<lastmod>of every<url>in the proxied VTEX sitemaps and leaves the<sitemap>blocks of the index alone. It is wired throughvtex/loaders/proxy.ts, next toremoveEntriesWithoutPage.Why
On oficina.com,
deco.xml(330 URLs) andcategory-0(31) were all dated today, andproduct-0(955) was all dated the day before. None of those dates says when a page changed. Google only trustslastmodwhen it is consistently accurate and learns that per site, so these dates also undermine the real dates in the blog sitemaps. An absent<lastmod>is neutral.Companion to deco-sites/oficina-reserva#806, which fixes the blog sitemaps' dates.
Test plan
Locally, with oficina-reserva's
apps/pointed at this branch:removeUrlLastmod: true/sitemap.xml(index)<sitemap>,lastmodkept/sitemap/deco.xmllastmodlastmod(unconditional)/sitemap/category-0.xmllastmodlastmod/sitemap/product-0.xmllastmod/sitemap/the-post-categories.xmllastmod(site handler, untouched)