---
title: "Sitemap.xml Best Practices"
description: "The best practices for generating a sitemap.xml file."
canonical_url: "https://nuxtseo.com/docs/sitemap/guides/best-practices"
last_updated: "2026-07-29T23:56:22.718Z"
---

## 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.

<warning>

**Accuracy is Critical**

Google has stated that they may **stop trusting** your `lastmod` dates if they are consistently updated without significant content changes. Ensure your `lastmod` logic is precise.

</warning>

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 in [Google's sitemap lastmod documentation](https://developers.google.com/search/blog/2023/06/sitemaps-lastmod-ping).

**You probably don't need changefreq or priority.** These two fields are ignored by most search engines, including Google. If you're trying to get your site crawled more often, you should use the `lastmod` field instead.

Learn more in [Google's sitemap best practices](https://developers.google.com/search/blog/2023/06/sitemaps-lastmod-ping).

## Set accurate sitemap index lastmod

When using multiple sitemaps, each `<lastmod>` in `sitemap_index.xml` describes when the sitemap file in the same `<sitemap>` block changed. Page modification dates belong to the URL entries inside that file.

Accurate dates allow crawlers to fetch only the sitemap files that changed. Leave the field out when you cannot produce a reliable date. Adding or removing a URL can change a sitemap file without changing the `lastmod` of any remaining page.

See the [`sitemap:index-resolved` recipe](/docs/sitemap/nitro-api/nitro-hooks#sitemap-index-resolved) for setting these dates from your database or sitemap metadata.

Learn more in [Google's sitemap index documentation](https://developers.google.com/search/docs/crawling-indexing/sitemaps/large-sitemaps#sitemap-index-reference).

## Use Zero Runtime when content only changes on deploy

If your pages only change when you commit and deploy (not at runtime), you don't need runtime sitemap generation. Enable `zeroRuntime` to generate sitemaps at build time and remove ~50KB of sitemap code from your server bundle.

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  sitemap: {
    zeroRuntime: true
  }
})
```

This is ideal for sites using `nuxt build` where content is static between deployments. If you're using a CMS that updates content without redeploying, you'll need runtime generation.

Learn more in the [Zero Runtime](/docs/sitemap/guides/zero-runtime) guide.

<callout icon="i-heroicons-check-circle" to="/tools/xml-sitemap-validator">

**Check your sitemap** - Validate your sitemap meets Google requirements with our [XML Sitemap Validator](/tools/xml-sitemap-validator).

</callout>

<checklist id="sitemap-best-practices" title="Quick Checklist">

- Set meaningful lastmod dates based on content changes
- Set sitemap index lastmod dates based on sitemap file changes
- Skip changefreq and priority (ignored by search engines)
- Enable zeroRuntime for static sites
- Submit sitemap to Google Search Console

</checklist>
