diff --git a/docs/content/1.guides/4.content.md b/docs/content/1.guides/4.content.md index d7af758b..29d06ce1 100644 --- a/docs/content/1.guides/4.content.md +++ b/docs/content/1.guides/4.content.md @@ -250,6 +250,25 @@ content: | } ``` +### `lastmod` from frontmatter dates + +The module sets `lastmod` on a content page from its frontmatter dates: + +1. A `sitemap.lastmod` in frontmatter always wins. +2. Otherwise the modification date: `seo.articleModifiedTime`, `updatedAt`, `modifiedAt`, `dateModified` or `lastModified`. +3. Otherwise the publication date: `seo.articlePublishedTime`, `publishedAt`, `datePublished` or `date`. + +A value that is not a date is skipped. The collection schema does not need to declare these keys. + +```md +--- +publishedAt: 2025-03-01 +updatedAt: 2025-06-12 +--- +``` + +This page gets `2025-06-12`. To read no frontmatter dates, set `contentLastmod: false`. + ### Exclude from Sitemap If you'd like to exclude a page from the sitemap, you can set `sitemap: false` in the frontmatter or `robots: false` diff --git a/docs/content/3.api/0.config.md b/docs/content/3.api/0.config.md index 0e8b14ac..1184187c 100644 --- a/docs/content/3.api/0.config.md +++ b/docs/content/3.api/0.config.md @@ -51,6 +51,12 @@ This will only do anything when using multiple sitemaps. Sets the current date as the default `lastmod` for all entries that don't already have one. +## `contentLastmod: boolean`{lang="ts"} + +- Default: `true`{lang="ts"} + +Sets `lastmod` on content pages from their frontmatter dates. See [Nuxt Content](/docs/sitemap/guides/content#lastmod-from-frontmatter-dates). Set `false` to read no frontmatter dates. + ## `sitemaps: boolean | Record & { index?: (string | SitemapIndexEntry)[] }` - Default: `false` diff --git a/skills/nuxtjs-sitemap/SKILL.md b/skills/nuxtjs-sitemap/SKILL.md index c1cd84d2..4f210a00 100644 --- a/skills/nuxtjs-sitemap/SKILL.md +++ b/skills/nuxtjs-sitemap/SKILL.md @@ -28,6 +28,7 @@ If `@nuxtjs/robots` is installed, the module adds the sitemap to `robots.txt`. I - Prerendered routes are added, including routes the prerender crawler finds. - A route with the `robots: false` route rule is dropped. So is a `robots` string with `noindex` or `none`. - When a page is prerendered, `` and `