Table of Contents
sitemap-core
Note: The options API is still evolving; expect tweaks as the project grows.
What it does
sitemap-core generates XML sitemaps via virtual templates. In single-language mode, it produces one sitemap at /sitemap.xml. In multilingual mode, it produces per-language sitemaps (/en/sitemap.xml, /nl/sitemap.xml, etc.) plus a sitemap index at /sitemap.xml. Every page gets computed sitemap defaults so you can control inclusion from front matter.
Defaults
- Template: enabled (
/sitemap.xml). - Per-page computed data:
page.sitemapwith{ ignore, changefreq, priority, lastmod }. - Exclusion rules: a page is excluded if
site.noindexis true (suppresses the entire sitemap),noindex: truein front matter,sitemap.ignore: true, oreleventyExcludeFromCollections: true. lastmod: usessitemap.lastmodfrom front matter, falls back toitem.date.- Layout:
nullfor the sitemap template; excluded from collections.
Options
| Option | Type | Default | Description |
|---|---|---|---|
enableSitemapTemplate |
boolean | true |
Toggle the built-in sitemap virtual template. |
How it works
-
Computed sitemap data.
Adds
eleventyComputed.page.sitemapto every page. This merges the page'snoindexstate, anysitemap:front matter fields, and site-levelnoindexinto a single object the templates can read. -
Single-language sitemap.
When the site is not multilingual, registers one virtual template at
/sitemap.xml. It loopscollections.all, filters out excluded pages, and emits a<urlset>with<loc>, optional<lastmod>, optional<changefreq>, and optional<priority>. -
Multilingual sitemaps.
When
multilingual: trueand alanguagesmap is set, registers a sitemap for each language (e.g./en/sitemap.xml) filtered to pages matching that language, plus a sitemap index at/sitemap.xmlthat points to each per-language sitemap. Hreflang alternates are rendered as<xhtml:link>entries usingcollections.translationsMap.
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 emits a robots meta tag (via head-core).sitemap.ignore: trueis sitemap-only exclusion — the page still renders and can be indexed.eleventyExcludeFromCollections: truekeeps the page out of collections and therefore out of the sitemap.
Tips
- Set
site.noindex: truein_data/site.jsto suppress the sitemap entirely — the template outputs an empty<urlset>. - Search engines treat
changefreqandpriorityas hints. Set them sparingly. - For
lastmod, provide a date in front matter; without one,item.date(the file date) is used. - URLs in the sitemap are absolutized via
htmlBaseUrlusingsite.url+pathPrefix. Keepsite.urlorigin-only. - See Sitemaps & Drafts for end-to-end usage.
Peer deps
None.
Previous: navigator-core