Sitemap.xml Best Practices

The best practices for generating a sitemap.xml file.

Set appropriate lastmod

The lastmod field is used to indicate when a page was last updated. This is used by search engines to determine how often to crawl your site.

This should not change based on code changes, only for updating the content.

For example, if you have a blog post, the lastmod should be updated when the content of the blog post changes.

It's recommended not to use autoLastmod: true as this will use the last time the page was built, which does not always reflect content updates.

Learn more https://developers.google.com/search/blog/2023/06/sitemaps-lastmod-ping

You probably don't need changefreq or priority

These two fields are not used by search engines, and are only used by crawlers to determine how often to crawl your site.

If you're trying to get your site crawled more often, you should use the lastmod field instead.

Learn more https://developers.google.com/search/blog/2023/06/sitemaps-lastmod-ping

Did this page help you?