---
title: "Lastmod, Priority, and Changefreq"
description: "Configure lastmod, priority, and changefreq values for your sitemap entries."
canonical_url: "https://nuxtseo.com/docs/sitemap/advanced/loc-data"
last_updated: "2026-05-14T00:35:55.555Z"
---

## 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](/docs/sitemap/guides/dynamic-urls), you can modify the data in the `sitemap` object, otherwise, you will
need to override the [app sources](/docs/sitemap/getting-started/data-sources) directly.

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

## Setting Defaults

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

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

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

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

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

```ts [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.

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

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

```vue [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`:

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

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

```ts [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:

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

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.

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