Debian Codegraph @

docs/content/en/templates/sitemap.md

raw
1 ---
2 title: Sitemap templates
3 description: Hugo provides built-in sitemap templates.
4 categories: []
5 keywords: []
6 weight: 130
7 aliases: [/layout/sitemap/,/templates/sitemap-template/]
8 ---
9
10 ## Overview
11
12 Hugo's embedded sitemap templates conform to v0.9 of the [sitemap protocol][].
13
14 With a monolingual project, Hugo generates a sitemap.xml file in the root of the [`publishDir`][] using the [embedded sitemap template][].
15
16 With a multilingual project, Hugo generates:
17
18 - A sitemap.xml file in the root of each site (language) using the [embedded sitemap template][]
19 - A sitemap.xml file in the root of the [`publishDir`][] using the [embedded sitemapindex template][]
20
21 ## Configuration
22
23 See [configure sitemap][].
24
25 ## Override default values
26
27 Override the default values for a given page in front matter.
28
29 {{< code-toggle file=news.md fm=true >}}
30 title = 'News'
31 [sitemap]
32 changefreq = 'weekly'
33 disable = true
34 priority = 0.8
35 {{</ code-toggle >}}
36
37 ## Override built-in templates
38
39 To override the built-in sitemap.xml template, create a new `layouts/sitemap.xml` file. When ranging through the page collection, access the _change frequency_ and _priority_ with `.Sitemap.ChangeFreq` and `.Sitemap.Priority` respectively.
40
41 To override the built-in sitemapindex.xml template, create a new `layouts/sitemapindex.xml` file.
42
43 ## Disable sitemap generation
44
45 You may disable sitemap generation in your project configuration:
46
47 {{< code-toggle file=hugo >}}
48 disableKinds = ['sitemap']
49 {{</ code-toggle >}}
50
51 [`publishDir`]: /configuration/all/#publishdir
52 [configure sitemap]: /configuration/sitemap/
53 [embedded sitemap template]: <{{% eturl sitemap %}}>
54 [embedded sitemapindex template]: <{{% eturl sitemapindex %}}>
55 [sitemap protocol]: https://www.sitemaps.org/protocol.html