Sitemap
Returns the sitemap settings for the given page as defined in front matter, falling back to the sitemap settings as defined in your project configuration.
Syntax
PAGE.Sitemap
Returns
config.SitemapConfig
Access to the Sitemap method on a Page object is restricted to sitemap templates.
Methods
Use these methods on the Sitemap object.
ChangeFreq- (
string) How frequently a page is likely to change. Valid values arealways,hourly,daily,weekly,monthly,yearly, andnever. With the default value of""Hugo will omit this field from the sitemap. See details.{{ .Sitemap.ChangeFreq }} Disable- (
bool) Whether to disable page inclusion. Default isfalse. Set totruein front matter to exclude the page.{{ .Sitemap.Disable }} Priority- (
float) The priority of a page relative to any other page on the site. Valid values range from 0.0 to 1.0. With the default value of-1Hugo will omit this field from the sitemap. See details.{{ .Sitemap.Priority }}
Example
With this project configuration:
sitemap:
changeFreq: monthly
[sitemap]
changeFreq = 'monthly'
{
"sitemap": {
"changeFreq": "monthly"
}
}
And this content:
---
sitemap:
changeFreq: hourly
title: News
---+++
title = 'News'
[sitemap]
changeFreq = 'hourly'
+++{
"sitemap": {
"changeFreq": "hourly"
},
"title": "News"
}
And this simplistic sitemap template:
layouts/sitemap.xml
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range .Pages }}
<url>
<loc>{{ .Permalink }}</loc>
{{ if not .Lastmod.IsZero }}
<lastmod>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</lastmod>
{{ end }}
{{ with .Sitemap.ChangeFreq }}
<changefreq>{{ . }}</changefreq>
{{ end }}
</url>
{{ end }}
</urlset>The change frequency will be hourly for the news page, and monthly for other pages.
Last updated:
May 28, 2026
:
content: Replace h3 method sequences with description lists (c8e5b9fd2)
Improve this page