Add lastmod to sitemap
See original GitHub issue🐛 Bug Report
The XML sitemaps currently output loc
, changefreq
and priority
for every url
set. I would propose dropping the changefreq
and priority
fields, as none of the search engines use these, and instead adding the lastmod
field, with the last modification date of the file.
Have you read the Contributing Guidelines on issues?
Yes.
To Reproduce
(Write your steps here:)
- Open any DocuSaurus v2 sitemap 😃
Expected behavior
The current output would be:
<url>
<loc>https://developer.yoast.com/features/canonical-urls/api</loc>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
(Write what you thought would happen.)
Actual Behavior
I propose changing it to:
<url>
<loc>https://developer.yoast.com/features/canonical-urls/api</loc>
<lastmod>2020-04-14T11:22:05+00:00</lastmod>
</url>
Your Environment
- Docusaurus version used: v2
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Add <lastmod> tag to every entry in the Sitemap
How to add a <lastmod> tag to every entry in the Sitemap so that the last modified date of the items is included?...
Read more >XML Sitemap: the ultimate reference guide | ContentKing
An XML Sitemap is a special document which lists all pages on a website to provide search engines with an overview of all...
Read more >Add and automatically update <lastmod> tag in sitemap - SEO
Hi Guys, Is there any possibility to add a tag to my sitemap and automatically update it every time I publish my site?...
Read more >Protocol - sitemaps.org
The optional <lastmod> tag is also available for Sitemap index files. ... the list into multiple text files and add each one separately....
Read more >how to add lastmod field in index sitemap django
I did some research, and modified generic function index: def index(request, sitemaps, template_name='sitemap_index.xml', ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would not add it then. Having it change all the time when it’s actually not changing is also not beneficial.
Agreed.
Thanks, will do that.
About lastModified, some plugins already read git history to get the last modified date. We can enable also to hardcode it through frontmatter.
I think we should:
addRoute
apis withlastModified: lastModifiedFrontmatter || lastModifiedGit || lastModifiedFS || undefined
If this info can’t be obtained (pages might not be generated from FS files), is it better to not add the lastmod entry, or to fallback to build time (which is likely to be a recent value if the site is built often).
We agree that this date should rather be updated when the content change, but not when the code (ie the layout rendering the content etc) change?