Table of Contents
sitemap
INTERNAL_KEY: '_sitemap'
What it does
The sitemap module emits /sitemap.xml from your built pages. In single-language mode, one flat sitemap. With multilang active, one sitemap per language at /<lang>/sitemap.xml plus a sitemap index at /sitemap.xml that points at each. The module also adds a computed page.sitemap to every page so you can opt pages out from front matter.
The sitemap is rendered through virtual templates: synthetic templates Baseline injects into the build, not files you write. They use Eleventy's normal collection access (collections.all) and the same data cascade your pages do.
Active when
options.sitemap is truthy. Defaults to true. Set sitemap: false to skip the module entirely.
Lifecycle
- Build-time. Registers virtual templates: a single
/sitemap.xml, or per-language sitemaps plus an index if multilang is active. - Cascade-time. Computed
page.sitemapresolves on every page from the cascade (itsignore,changefreq,priorityfields).
The sitemap virtual templates set _internal: true so they do not get a page context. They are emitted as XML, not HTML, and the head module skips them.
How it works
- Compute
page.sitemap. Registered aseleventyComputed.page.sitemap. Resolvesignore,changefreq,priorityfrom cascade data. - Resolve language config. Reads
settings.languagesthroughnormalizeLanguages, the same helper the multilang module uses. - Register virtual templates.
- Single-language: one template at
/sitemap.xml. Loopscollections.all, filters excluded pages, emits<urlset>with<loc>, optional<lastmod>, optional<changefreq>, optional<priority>. - Multilingual: one template per language at
<lang>/sitemap.xml, plus a sitemap index template at/sitemap.xml. Per-language sitemaps include<xhtml:link>alternates for every translation sibling, sourced from the translation map.
- Single-language: one template at
Each virtual template sets _internal: true so the page-context registry skips it (it is not a real page). It also sets eleventyExcludeFromCollections: true so the sitemap does not list itself.
Defaults
- Sitemap output.
/sitemap.xmlin single-language mode, or/<lang>/sitemap.xmlplus/sitemap.xml(the index) when multilang is active. - Computed
page.sitemap. Every page receives{ ignore, changefreq, priority }.ignore: resolved fromdata.noindex,data.page.noindex, ordata.settings.noindex.changefreq:''(omitted in output unless you set it).priority:-1(omitted in output unless you set it).
- Exclusion rules. A page is left out of the sitemap if any of the following are true:
settings.noindex(suppresses the entire sitemap),noindex: truein front matter,sitemap.ignore: truein front matter,eleventyExcludeFromCollections: true.
Settings
The sitemap module reads three keys on the settings argument. Full shape on Site settings.
| Key | Type | Used for |
|---|---|---|
settings.url |
string |
Building absolute <loc> entries. |
settings.noindex |
boolean |
When true, the entire sitemap is suppressed (or rendered empty). |
settings.languages |
object |
Drives per-language partitioning when multilang is active. Read through the same normalisation as the multilang module. |
Options
| Option | Type | Default | Meaning |
|---|---|---|---|
sitemap |
boolean |
true |
Activate the module. Set false to skip it. |
Per-page sitemap controls
Set these in front matter:
sitemap:
ignore: true # exclude from sitemap (page still renders)
changefreq: weekly
priority: 0.8
lastmod: 2026-01-15
noindex: truein front matter excludes the page from the sitemap and (because the head module reads the same field) emits arobotsmeta tag.sitemap.ignore: trueis sitemap-only exclusion. The page still renders and search engines can still index it.eleventyExcludeFromCollections: truekeeps the page out of all collections, includingcollections.all, so the sitemap never sees it.
lastmod uses sitemap.lastmod if you set it; otherwise the page date.
Multilingual mode
When the multilang module is active and settings.languages has more than one entry, the layout switches automatically:
/en/sitemap.xml,/nl/sitemap.xml, etc.: one per language, listing only that language's pages plus hreflang alternates./sitemap.xml: a sitemap index pointing at each per-language sitemap.
Tips
- Set
settings.noindex: trueto suppress the sitemap entirely (useful for staging environments). - Search engines treat
changefreqandpriorityas hints. Set them sparingly, only where you actually have a useful answer. - Provide
lastmodin front matter when you care about freshness signals. Without one, the page date is used. - URLs are absolutized via Eleventy's
HtmlBasePluginusingsettings.urlandpathPrefix. Keepsettings.urlorigin-only (no trailing path), and usepathPrefixfor sub-path deployments.
Peer deps
None.
See also
- Site settings for
url,noindex,languages. - multilang module for the language normalisation and translation map shared with this module.
- Page context for
_internal: true, the opt-out the virtual templates use. - Tutorial: sitemaps and drafts
Previous: navigator