Sitemap templates
Overview
Hugo’s embedded sitemap templates conform to v0.9 of the sitemap protocol.
With a monolingual project, Hugo generates a sitemap.xml file in the root of the public directory using the embedded sitemap template.
With a multilingual project, Hugo generates these files:
- A sitemap.xml file in the root of each site (language) using the embedded sitemap template
- A sitemap.xml file in the root of the
publicdirectory using the embedded sitemapindex template
Configuration
Set the default values for all pages in your sitemap configuration.
Override default values
Override the default values for a given page in front matter:
---
sitemap:
changefreq: weekly
disable: true
priority: 0.8
title: News
---+++
title = 'News'
[sitemap]
changefreq = 'weekly'
disable = true
priority = 0.8
+++{
"sitemap": {
"changefreq": "weekly",
"disable": true,
"priority": 0.8
},
"title": "News"
}
Override the embedded templates
To override the embedded sitemap template, create a layouts/sitemap.xml file in your project or in a module. When ranging through the page collection, access the change frequency and priority of each page with .Sitemap.ChangeFreq and .Sitemap.Priority.
To override the embedded sitemapindex template, create a layouts/sitemapindex.xml file.
To use a different sitemap template for a language, role, or version, include an identifier in the file name, such as layouts/sitemap.de.xml or layouts/sitemap._role_member_.xml.
Disable sitemap generation
To disable sitemap generation, add this to your project configuration:
disableKinds:
- sitemap
disableKinds = ['sitemap']
{
"disableKinds": [
"sitemap"
]
}
