Lastmod, Priority, and Changefreq · Nuxt Sitemap · Nuxt SEO

[NuxtSEO](https://nuxtseo.com/ "Home")

- [Modules](https://nuxtseo.com/docs/nuxt-seo/getting-started/introduction)
- [Tools](https://nuxtseo.com/tools)
- [Pro](https://nuxtseo.com/pro)
- [Learn SEO](https://nuxtseo.com/learn-seo/nuxt) [Releases](https://nuxtseo.com/releases)

[1.4K](https://github.com/harlan-zw/nuxt-seo)

[Nuxt SEO on GitHub](https://github.com/harlan-zw/nuxt-seo)

[User Guides](https://nuxtseo.com/docs/sitemap/getting-started/introduction)

[API](https://nuxtseo.com/docs/sitemap/api/config)

[Releases](https://nuxtseo.com/docs/sitemap/releases/v8)

Sitemap

- [Switch to Sitemap](https://nuxtseo.com/docs/sitemap/getting-started/introduction)
- [Switch to Nuxt SEO](https://nuxtseo.com/docs/nuxt-seo/getting-started/introduction)
- [Switch to Robots](https://nuxtseo.com/docs/robots/getting-started/introduction)
- [Switch to OG Image](https://nuxtseo.com/docs/og-image/getting-started/introduction)
- [Switch to Schema.org](https://nuxtseo.com/docs/schema-org/getting-started/introduction)
- [Switch to Link Checker](https://nuxtseo.com/docs/link-checker/getting-started/introduction)
- [Switch to SEO Utils](https://nuxtseo.com/docs/seo-utils/getting-started/introduction)
- [Switch to Site Config](https://nuxtseo.com/docs/site-config/getting-started/introduction)
- [Switch to Skew Protection](https://nuxtseo.com/docs/skew-protection/getting-started/introduction)
- [Switch to AI Ready](https://nuxtseo.com/docs/ai-ready/getting-started/introduction)

Search…```k`` /`

v8.0.12

- Playgrounds
- [Discord Support](https://discord.com/invite/275MBUBvgP)

### Getting Started

- [Introduction](https://nuxtseo.com/docs/sitemap/getting-started/introduction)
- [Installation](https://nuxtseo.com/docs/sitemap/getting-started/installation)
- [Data Sources](https://nuxtseo.com/docs/sitemap/getting-started/data-sources)
- [Troubleshooting](https://nuxtseo.com/docs/sitemap/getting-started/troubleshooting)

### Core Concepts

- [Dynamic URL Endpoints](https://nuxtseo.com/docs/sitemap/guides/dynamic-urls)
- [Disabling Indexing](https://nuxtseo.com/docs/sitemap/guides/filtering-urls)
- [Multi Sitemaps](https://nuxtseo.com/docs/sitemap/guides/multi-sitemaps)
- [I18n](https://nuxtseo.com/docs/sitemap/guides/i18n)
- [Nuxt Content](https://nuxtseo.com/docs/sitemap/guides/content)
- [Nuxt Prerendering](https://nuxtseo.com/docs/sitemap/guides/prerendering)
- [Best Practices](https://nuxtseo.com/docs/sitemap/guides/best-practices)
- [Submitting Your Sitemap](https://nuxtseo.com/docs/sitemap/guides/submitting-sitemap)
- [Zero Runtime](https://nuxtseo.com/docs/sitemap/guides/zero-runtime)

### Advanced

- [Lastmod, Priority, and Changefreq](https://nuxtseo.com/docs/sitemap/advanced/loc-data)
- [Images, Videos, News](https://nuxtseo.com/docs/sitemap/advanced/images-videos)
- [Sitemap Performance](https://nuxtseo.com/docs/sitemap/advanced/performance)
- [Sitemap Chunking](https://nuxtseo.com/docs/sitemap/advanced/chunking-sources)
- [Customising the UI](https://nuxtseo.com/docs/sitemap/advanced/customising-ui)

Advanced

# Lastmod, Priority, and Changefreq

[Copy for LLMs](https://nuxtseo.com/docs/sitemap/advanced/loc-data.md)

## [Introduction](#introduction)

Changing the `<loc>` entry data can be useful for a variety of reasons, such as changing the `changefreq`, `priority`, or `lastmod` values.

If you're using [Dynamic URLs](https://nuxtseo.com/docs/sitemap/guides/dynamic-urls), you can modify the data in the `sitemap` object, otherwise, you will need to override the [app sources](https://nuxtseo.com/docs/sitemap/getting-started/data-sources) directly.

While modifying these in most cases may be unnecessary, see [Best Practices](https://nuxtseo.com/docs/sitemap/guides/best-practices), it can be useful when used right.

## [Setting Defaults](#setting-defaults)

While this is not recommended, in special circumstances you may wish to set defaults for your sitemap entries:

nuxt.config.ts

```
export default defineNuxtConfig({
  sitemap: {
    defaults: {
      lastmod: new Date().toISOString(),
      priority: 0.5,
      changefreq: 'weekly'
    }
  }
})
```

## [Data Source Merging](#data-source-merging)

You can provide the page you want to set the `lastmod`, `priority`, or `changefreq` for in your app sources, which includes the `urls` config.

nuxt.config.ts

```
export default defineNuxtConfig({
  sitemap: {
    urls: [
      {
        loc: '/about',
        lastmod: '2023-01-01',
        priority: 0.3,
        changefreq: 'daily'
      }
    ]
  }
})
```

## [Modify Loc Data With Route Rules](#modify-loc-data-with-route-rules)

To change the behaviour of your sitemap URLs, you can use [Route rules](https://nuxt.com/docs/api/configuration/nuxt-config/#routerules).

nuxt.config.ts

```
export default defineNuxtConfig({
  routeRules: {
    // Don't add any /secret/** URLs to the sitemap.xml
    '/secret/**': { robots: false },
    // modify the sitemap.xml entry for specific URLs
    '/about': { sitemap: { changefreq: 'daily', priority: 0.3 } }
  }
})
```

Alternatively, you can use the experimental macro [`defineRouteRules()`](https://nuxt.com/docs/api/utils/define-route-rules), which must be enabled.

pages/index.vue

```
<script setup>
defineRouteRules({
  sitemap: {
    changefreq: 'daily',
    priority: 0.3
  }
})
</script>
```

## [Modify Loc Data With Page Meta](#modify-loc-data-with-page-meta)

You can configure sitemap entry data directly in your page components using [`definePageMeta()`](https://nuxt.com/docs/api/utils/define-page-meta).

pages/about.vue

```
<script setup>
definePageMeta({
  sitemap: {
    changefreq: 'daily',
    priority: 0.8
  }
})
</script>
```

To exclude a page from the sitemap entirely, set `sitemap` to `false`:

pages/secret.vue

```
<script setup>
definePageMeta({
  sitemap: false
})
</script>
```

The `sitemap` key is extracted at build time via Nuxt's `scanPageMeta`, so these values are available without runtime overhead.

## [Dynamic lastmod from APIs](#dynamic-lastmod-from-apis)

When fetching dynamic URLs, include lastmod from your data source:

server/api/__sitemap__/urls.ts

```
import { defineSitemapEventHandler } from '#imports'

export default defineSitemapEventHandler(async () => {
  const posts = await $fetch('https://api.example.com/posts')
  return posts.map(post => ({
    loc: \`/blog/${post.slug}\`,
    lastmod: post.updated_at,
  }))
})
```

With Nuxt Content, set `lastmod` in frontmatter:

```
---
sitemap:
  lastmod: 2024-01-15
  changefreq: weekly
---
```

The `lastmod` field accepts `Date` objects, ISO 8601 strings (`'2024-01-15T10:30:00Z'`), or simple date strings (`'2024-01-15'`). Only include it if you have accurate update timestamps — avoid using current date/time for all URLs.

## [Lastmod: Prerendering Hints](#lastmod-prerendering-hints)

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>
```

[Edit this page](https://github.com/nuxt-modules/sitemap/edit/main/docs/content/2.advanced/0.loc-data.md)

[Markdown For LLMs](https://nuxtseo.com/docs/sitemap/advanced/loc-data.md)

Did this page help you?

### Related

[Best Practices](https://nuxtseo.com/docs/sitemap/guides/best-practices) [Dynamic URL Endpoints](https://nuxtseo.com/docs/sitemap/guides/dynamic-urls) [Nuxt Prerendering](https://nuxtseo.com/docs/sitemap/guides/prerendering)

[Zero Runtime Generate sitemaps at build time without runtime overhead.](https://nuxtseo.com/docs/sitemap/guides/zero-runtime) [Images, Videos, News Learn how to add images, videos and news in your sitemap.](https://nuxtseo.com/docs/sitemap/advanced/images-videos)

On this page

- [Introduction](#introduction)
- [Setting Defaults](#setting-defaults)
- [Data Source Merging](#data-source-merging)
- [Modify Loc Data With Route Rules](#modify-loc-data-with-route-rules)
- [Modify Loc Data With Page Meta](#modify-loc-data-with-page-meta)
- [Dynamic lastmod from APIs](#dynamic-lastmod-from-apis)
- [Lastmod: Prerendering Hints](#lastmod-prerendering-hints)

[GitHub](https://github.com/harlan-zw/nuxt-seo) [ Discord](https://discord.com/invite/275MBUBvgP)

### [NuxtSEO](https://nuxtseo.com/ "Home")

- [Getting Started](https://nuxtseo.com/docs/nuxt-seo/getting-started/introduction)
- [MCP](https://nuxtseo.com/docs/nuxt-seo/guides/mcp)

Modules

- [Robots](https://nuxtseo.com/docs/robots/getting-started/introduction)
- [Sitemap](https://nuxtseo.com/docs/sitemap/getting-started/introduction)
- [OG Image](https://nuxtseo.com/docs/og-image/getting-started/introduction)
- [Schema.org](https://nuxtseo.com/docs/schema-org/getting-started/introduction)
- [Link Checker](https://nuxtseo.com/docs/link-checker/getting-started/introduction)
- [SEO Utils](https://nuxtseo.com/docs/seo-utils/getting-started/introduction)
- [Site Config](https://nuxtseo.com/docs/site-config/getting-started/introduction)
- [Skew Protection](https://nuxtseo.com/docs/skew-protection/getting-started/introduction)
- [AI Ready](https://nuxtseo.com/docs/ai-ready/getting-started/introduction)

### [NuxtSEO Pro](https://nuxtseo.com/pro "Home")

- [Getting Started](https://nuxtseo.com/pro)
- [Dashboard](https://nuxtseo.com/pro/dashboard)
- [Pro MCP](https://nuxtseo.com/docs/nuxt-seo-pro/mcp/installation)

### [Learn SEO](https://nuxtseo.com/learn-seo "Learn SEO")

Nuxt

- [Mastering Meta](https://nuxtseo.com/learn-seo/nuxt/mastering-meta)
- [Controlling Crawlers](https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers)
- [Launch & Listen](https://nuxtseo.com/learn-seo/nuxt/launch-and-listen)
- [Routes & Rendering](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering)
- [Staying Secure](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering/security)

Vue

- [Vue SEO Guide](https://nuxtseo.com/learn-seo/vue)
- [Mastering Meta](https://nuxtseo.com/learn-seo/vue/mastering-meta)
- [Controlling Crawlers](https://nuxtseo.com/learn-seo/vue/controlling-crawlers)
- [SPA SEO](https://nuxtseo.com/learn-seo/vue/spa)
- [SSR Frameworks](https://nuxtseo.com/learn-seo/vue/ssr-frameworks)
- [SEO Checklist](https://nuxtseo.com/learn-seo/checklist)
- [Pre-Launch Warmup](https://nuxtseo.com/learn-seo/pre-launch-warmup)
- [Backlinks & Authority](https://nuxtseo.com/learn-seo/backlinks)

### [Tools](https://nuxtseo.com/tools "SEO Tools")

- [Social Share Debugger](https://nuxtseo.com/tools/social-share-debugger)
- [Robots.txt Generator](https://nuxtseo.com/tools/robots-txt-generator)
- [Meta Tag Checker](https://nuxtseo.com/tools/meta-tag-checker)
- [HTML to Markdown](https://nuxtseo.com/tools/html-to-markdown)
- [XML Sitemap Validator](https://nuxtseo.com/tools/xml-sitemap-validator)
- [Schema.org Validator](https://nuxtseo.com/tools/schema-validator)
- [Keyword Idea Generator](https://nuxtseo.com/tools/keyword-generator)
- [Keyword Research](https://nuxtseo.com/tools/keyword-research)
- [SERP Analyzer](https://nuxtseo.com/tools/serp-analyzer)
- [Domain Rankings](https://nuxtseo.com/tools/domain-rankings)

Copyright © 2023-2026 Harlan Wilton - [MIT License](https://github.com/harlan-zw/nuxt-seo/blob/main/license) · [mdream](https://mdream.dev)