Sitemap
Guides

Setting Lastmod

Learn how to set the lastmod of your sitemap URLs.

In some cases you'll want to set the lastmod, changefreq, or priority of your sitemap URLs. To do this, you have a few options depending on your setup.

See Best Practices for details on how to optimize these values.

Page Meta

Support for configuring these values through definePageMeta is coming soon.

Prerendering Lastmod

When prerendering your site, you can make use of setting the article:modified_time meta tag in your page's head. This meta tag will be used as the lastmod value in your sitemap.

pages/index.vue
<script setup>
useSeoMeta({
  // will be inferred as the lastmod value in the sitemap
  articleModifiedTime: '2023-01-01'
})
</script>

Route Rules

A more general approach is to use Route rules.

nuxt.config.ts
export default defineNuxtConfig({
  routeRules: {
    '/about': { sitemap: { changefreq: 'daily', priority: 0.3 } }
  }
})

Alternatively, you can use the defineRouteRules helper on specific pages.

pages/index.vue
<script setup>
defineRouteRules({
  sitemap: {
    changefreq: 'daily',
    priority: 0.3
  }
})
</script>

Using defineRouteRules feature is experimental and in order to use it you must enable the experimental.inlineRouteRules option in your nuxt.config.