Start building your site, skip the recurring setup work.
Table of Contents

Plugin entrypoint

The baseline() factory is the single entry point. You call it once in your Eleventy config callback with two arguments: site settings and module options. Everything below is what that call sets up.

For the directory contract Baseline ships alongside the factory, see Config export. For the settings argument, see Site settings. This page covers the second argument, options, which controls module activation and behaviour.


Default usage

import baseline, { config as baselineConfig } from '@apleasantview/eleventy-plugin-baseline';
import settings from './src/_data/settings.js';

/** @param {import("@11ty/eleventy").UserConfig} eleventyConfig */
export default async function (eleventyConfig) {
	await eleventyConfig.addPlugin(baseline(settings));
}

export const config = baselineConfig;

baseline() itself is synchronous, but it returns an async closure (Eleventy's documented async-plugin pattern). The await on addPlugin is the correct shape.


Options

await eleventyConfig.addPlugin(
	baseline(settings, {
		verbose: true,
		multilingual: false,
		sitemap: true,
		navigator: true,
		head: { titleSeparator: ' – ', showGenerator: false },
		assets: { esbuild: {} }
	})
);
  • verbose (true)
    Emit Baseline's build narrative: the boxed startup banner, a "Baseline vX, running Eleventy vY" line, and info-level lines from the plugin and its modules. warn and error always emit regardless. Set to false for a silent build.

  • multilingual (false)
    Turn on the multilang module. Activation is explicit: all three of options.multilingual: true, settings.defaultLanguage, and a non-empty settings.languages are required. Nothing is inferred.

  • sitemap (true)
    Generate XML sitemaps. Set to false if you produce sitemaps elsewhere.

  • navigator (true in development, false otherwise)
    Register debug globals and the optional /navigator-core.html introspection template. Boolean toggles both. Object form { template, inspectorDepth } tunes them independently: template (boolean) controls whether the page renders, inspectorDepth (integer, default 4) sets how deep the _inspect filter walks. See the navigator module for the surface.

  • head.titleSeparator (' – ')
    String placed between the page title and the site title in <title>.

  • head.titleTemplate (none)
    Template for the whole <title>, with tokens %s (page title), %siteTitle%, and %tagline%. Overrides the separator composition. A page can also set its own titleTemplate in front matter, or null for a bare title.

  • head.showGenerator (false)
    Emit a <meta name="generator"> tag in the head.

  • assets.esbuild ({})
    An options bag forwarded to esbuild. See the esbuild documentation for keys.


What Baseline registers

In the order the entry point runs:

  • Reserved data keys - twelve reserved keys initialised to {} so module-namespaced data can merge cleanly. See Globals.
  • _baseline top-level + env - name and version at the top level; env carries mode (read from process.env.ELEVENTY_ENV) and package (npm package name). Mirrors the shape of Eleventy's own eleventy global.
  • _baseline.options - snapshot of the resolved options object (state.options).
  • Date global - a date function exposed to templates.
  • HtmlBasePlugin - sets baseHref from process.env.URL or pathPrefix.
  • _baseline.features - flags reflecting the resolved options.
  • Virtual directories - synthesises the assets and public keys on eleventyConfig.directories. See Config export for the asymmetry with the on-disk static/ folder.
  • Passthrough copy - mounts the public virtual directory at the site root /.
  • _baseline.paths - resolved input, output, includes, data, assets, and public directories.
  • Drafts preprocessor - skips pages with draft: true when ELEVENTY_RUN_MODE === 'build'. Guarded: if you have already registered a drafts preprocessor, Baseline leaves it alone.
  • Runtime stores - content-map and translation-map stores; used by the page-context registry and the head module.
  • Page-context registry - per-page object built at cascade-time, exposed as _pageContext. See Page context.
  • Modules - registered in order: multilang (when active), sitemap (when active), navigator (when active), head, assets. The last two are unconditional.
  • Filters - markdownify, relatedPosts, isString. Module-specific filters are documented on Filters.
  • Shortcode: image - responsive <picture> via @11ty/eleventy-img. See Image shortcode.
  • Image dev server - on-demand image generation during --serve.
  • Markdown substrate - three plugins applied through amendLibrary('md', ...), each guarded by a safeUse helper that skips re-registering plugins a user already loaded: markdown-it-attrs (for {#id .class} syntax on any element), an auto-heading-ids plugin (assigns stable id attrs with WordPress-style dedup; manual ids win), and the wikilinks plugin ([[slug]] / [[slug:lang]] / [[slug|alias]] / [[slug#anchor]] resolution). See Content helpers for the author-facing syntax.
  • Content-graph pre-pass - sentinel-guarded inner build that runs on every eleventy.before event, walks every rendered page, writes .cache/_baseline/content-graph.json, and hooks the result into the cascade as eleventyComputed._node (the page's own graph node), eleventyComputed._backlinks (edges where to === page.url, as bare edge records), and eleventyComputed._outgoing (edges where from === page.url, same shape). The site-wide view is on the navigator's _navigator global ({ nodes, edges, backlinks }).

The head module's render strategy is selected by a code-level driver seam, not a user option. One driver ships today. See Internals.


Plugin metadata

baseline() returns a function whose name property is set to @apleasantview/eleventy-plugin-baseline, so eleventyConfig.hasPlugin('@apleasantview/eleventy-plugin-baseline') returns true once the plugin is added.

Not included

@11ty/eleventy-img's HTML transform (eleventyImageTransformPlugin) is not bundled. Add it yourself if you want content-level <img> rewrites. The image shortcode works either way; the difference is whether <img> tags written into Markdown also get transformed.


See also

Previous: Core reference

Next: Site settings