Eleventy Plugin Baseline

A magic carpet ride

Documentation — Table of Contents

Sitemaps & Drafts

Control sitemap output and drafts with Baseline defaults. You’ll set site.url, tweak per-page sitemap fields, use noindex, and see how draft: true behaves in dev vs build.

What you’ll build

Prerequisites

1) Ensure Baseline sitemap is on (default)

eleventy.config.js with default options keeps the sitemap module enabled:

import baseline, { config as baselineConfig } from "@apleasantview/eleventy-plugin-baseline";

/** @param {import("@11ty/eleventy").UserConfig} eleventyConfig */
export default function (eleventyConfig) {
  // Sitemap is enabled by default
  eleventyConfig.addPlugin(baseline());
}

export const config = baselineConfig;

2) Page with sitemap controls

Create src/content/pages/sitemap-demo.md:

---
title: "Sitemap Demo"
description: "Control sitemap entries."
permalink: "/sitemap-demo/"
layout: "layouts/base.njk"
sitemap:
  changefreq: weekly
  priority: 0.7
  lastmod: 2024-01-01
---

This page stays in the sitemap with custom frequency, priority, and lastmod.

3) Noindex (site-wide only) and per-page exclusion

4) Drafts

Add draft: true in front matter:

draft: true

5) Run and inspect

npx rimraf dist/ && npm run dev

6) Production build

npx rimraf dist/ && npm run build

Then inspect dist/sitemap.xml:

7) Multilingual note

If multilingual is enabled, Baseline emits per-language sitemaps (e.g., /en/sitemap.xml, /nl/sitemap.xml) plus the root sitemap index. Per-page ignore/noindex/draft rules still apply per entry.

8) Next steps

Previous: Debugging & Navigator

Next: Custom Social Previews