Eleventy Plugin Baseline

A magic carpet ride

Table of Contents

sitemap-core

Note: The options API is still evolving; expect tweaks as the project grows.

What it does

  • Generates a sitemap at /sitemap.xml via a virtual template (enabled by default).
  • Adds eleventyComputed.page.sitemap with defaults so you can control per-page inclusion.

Defaults

  • Template enabled: yes (/sitemap.xml).
  • page.sitemap defaults: { ignore: noindex ?? page.noindex ?? site.noindex ?? false, changefreq: "", priority: -1 }.
  • Excludes pages if site.noindex is true, or if eleventyExcludeFromCollections is set, or if page.sitemap.ignore is true.
  • lastmod uses page.data.sitemap.lastmod or item.date if present, formatted via the date.toUTCISO global.
  • layout: null for the sitemap template; excluded from collections.

Options

  • enableSitemapTemplate (boolean): toggle the built-in sitemap template (default: true).

How it works

  • Registers eleventyComputed.page.sitemap to give every page sitemap defaults.
  • If sitemap template is enabled, registers:
    • A single sitemap at /sitemap.xml if site is in one language.
  • If multilingual and languages are supplied:
    • A sitemap for each language in the root of each language (/en/sitemap.xml).
    • A sitemap index at /sitemap.xml.
  • Each sitemap loops collections.all, filters out excluded items, and emits a <urlset> with loc, optional lastmod, optional changefreq, optional priority, and xhtml:link alternates when translations exist.

Tips

  • Set site.noindex = true to suppress the sitemap entirely.
  • On a page, set sitemap: { ignore: true } to skip it, or set changefreq/priority to include those fields.
  • Provide sitemap.lastmod (a date) to emit <lastmod>; otherwise item.date is used when available.
  • For multilingual sites, supply languages (object) and multilingual: true in Baseline options to emit per-language sitemaps and a sitemap index with alternates.
  • Per-page noindex: true (front matter) is respected by sitemap-core; use sitemap.ignore or eleventyExcludeFromCollections for explicit sitemap-only exclusion.
  • See the “Sitemaps & Drafts” tutorial for end-to-end usage.
  • Tutorial: Sitemaps & Drafts

Previous: navigator-core