HUGO Docs

  • News
  • About
    • In this section
    • Introduction
    • Features
    • Privacy
    • Security
    • License
  • Installation
    • In this section
    • macOS
    • Linux
    • Windows
    • BSD
  • Getting started
    • In this section
    • Quick start
    • Basic usage
    • Directory structure
    • Configuration
    • Configure markup
    • Glossary of terms
    • External learning resources
  • Quick reference
    • In this section
    • Emojis
    • Functions
    • Methods
    • Page collections
  • Content management
    • In this section
    • Organization
    • Page bundles
    • Content formats
    • Front matter
    • Build options
    • Page resources
    • Image processing
    • Shortcodes
    • Related content
    • Sections
    • Content types
    • Archetypes
    • Taxonomies
    • Summaries
    • Links and cross references
    • URL management
    • Menus
    • Comments
    • Multilingual
    • Markdown attributes
    • Syntax highlighting
    • Diagrams
    • Mathematics
    • Data sources
    • Content adapters
  • Templates
    • In this section
    • Introduction
    • Template types
    • Lookup order
    • Base templates
    • Home templates
    • Single templates
    • Section templates
    • Taxonomy templates
    • Term templates
    • Partial templates
    • Content view templates
    • Shortcode templates
    • Sitemap templates
    • RSS templates
    • 404 templates
    • robots.txt templates
    • Menus
    • Pagination
    • Embedded templates
    • Custom output formats
  • Functions
    • In this section
    • cast
    • collections
    • compare
    • crypto
    • css
    • data
    • debug
    • diagrams
    • encoding
    • fmt
    • global
    • go template
    • hugo
    • images
    • inflect
    • js
    • lang
    • math
    • openapi3
    • os
    • partials
    • path
    • reflect
    • resources
    • safe
    • strings
    • templates
    • time
    • transform
    • urls
  • Methods
    • In this section
    • Duration
    • Menu
    • Menu entry
    • Page
    • Pager
    • Pages
    • Resource
    • Shortcode
    • Site
    • Taxonomy
    • Time
  • Render hooks
    • In this section
    • Introduction
    • Code blocks
    • Headings
    • Images
    • Links
  • Hugo Modules
    • In this section
    • Configure Hugo modules
    • Use Hugo Modules
    • Theme components
  • Hugo Pipes
    • In this section
    • Introduction
    • Transpile Sass to CSS
    • PostCSS
    • PostProcess
    • JavaScript building
    • Babel
    • Asset minification
    • Concatenating assets
    • Fingerprinting and SRI hashing
    • Resource from string
    • Resource from template
  • CLI
  • Troubleshooting
    • In this section
    • Audit
    • Logging
    • Inspection
    • Deprecation
    • Performance
    • FAQs
  • Developer tools
    • In this section
    • Editor plugins
    • Front-ends
    • Search
    • Migrations
    • Other projects
  • Hosting and deployment
    • In this section
    • Hugo Deploy
    • Deploy with Rclone
    • Deploy with Rsync
    • Host on 21YunBox
    • Host on AWS Amplify
    • Host on Azure Static Web Apps
    • Host on Cloudflare Pages
    • Host on Firebase
    • Host on GitHub Pages
    • Host on GitLab Pages
    • Host on KeyCDN
    • Host on Netlify
    • Host on Render
  • Contribute
    • In this section
    • Development
    • Documentation
    • Themes
  • Maintenance
TEMPLATES

Sitemap templates

Hugo provides built-in 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 publishDir using the embedded sitemap template.

With a multilingual project, Hugo generates:

  • 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 publishDir using the embedded sitemapindex template

Configuration

These are the default sitemap configuration values. They apply to all pages unless overridden in front matter.

hugo.
     
sitemap:
  changeFreq: ""
  disable: false
  filename: sitemap.xml
  priority: -1
[sitemap]
  changeFreq = ''
  disable = false
  filename = 'sitemap.xml'
  priority = -1
{
   "sitemap": {
      "changeFreq": "",
      "disable": false,
      "filename": "sitemap.xml",
      "priority": -1
   }
}
changefreq
(string) How frequently a page is likely to change. Valid values are always, hourly, daily, weekly, monthly, yearly, and never. With the default value of "" Hugo will omit this field from the sitemap. See details.
disable New in v0.125.0
(bool) Whether to disable page inclusion. Default is false. Set to true in front matter to exclude the page.
filename
(string) The name of the generated file. Default is sitemap.xml.
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 -1 Hugo will omit this field from the sitemap. See details.

Override default values

Override the default values for a given page in front matter.

news.md
     
---
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 built-in templates

To override the built-in sitemap.xml template, create a new file in either of these locations:

  • layouts/sitemap.xml
  • layouts/_default/sitemap.xml

When ranging through the page collection, access the change frequency and priority with .Sitemap.ChangeFreq and .Sitemap.Priority respectively.

To override the built-in sitemapindex.xml template, create a new file in either of these locations:

  • layouts/sitemapindex.xml
  • layouts/_default/sitemapindex.xml

Disable sitemap generation

You may disable sitemap generation in your site configuration:

hugo.
     
disableKinds:
- sitemap
disableKinds = ['sitemap']
{
   "disableKinds": [
      "sitemap"
   ]
}

See also

  • Archetypes
  • Babel
  • Content adapters
  • Front matter
  • Markdown attributes

On this page

  • Overview
  • Configuration
  • Override default values
  • Override built-in templates
  • Disable sitemap generation
Last updated: July 5, 2024: hugo doc (a0ca0ab)
Improve this page
 

The Hugo logos are copyright © Steve Francia 2013–2024.

The Hugo Gopher is based on an original work by Renée French.

  • News
  • About
  • Installation
  • Getting started
  • Quick reference
  • Content management
  • Templates
  • Functions
  • Methods
  • Render hooks
  • Hugo Modules
  • Hugo Pipes
  • CLI
  • Troubleshooting
  • Developer tools
  • Hosting and deployment
  • Contribute
  • Maintenance