---
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-07-30T10:04:50.326Z"
---

## 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 behavior 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'`). If a value can't be parsed as a valid W3C date, the module drops it from that entry's output (with a dev-time warning) rather than emitting a broken `<lastmod>` tag.

### Why Accuracy Matters

`lastmod` isn't a ranking signal, it's a recrawl-priority hint: search engines use it to decide which URLs are worth fetching again. Google's own sitemap documentation is explicit that if the dates don't reflect real changes to the page, it may stop trusting `lastmod` for that sitemap entirely and fall back to its own crawl signals. In practice that means:

- Only set `lastmod` when you can trace it to an actual content change, e.g. a CMS `updatedAt` field.
- Don't set every URL's `lastmod` to `new Date()` on each build or request, that reads as fabricated to crawlers and defeats the purpose of having the field.
- Static `defaults.lastmod` (see [Setting Defaults](#setting-defaults)) is fine for a one-off baseline, but shouldn't be used as an ongoing substitute for real per-page timestamps.

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