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) {
eleventyConfig.addPlugin(baseline(settings));
}
export const config = baselineConfig;
Options
eleventyConfig.addPlugin(
baseline(settings, {
verbose: false,
multilingual: false,
sitemap: true,
navigator: true,
head: { titleSeparator: ' – ', showGenerator: false },
assets: { esbuild: {} }
})
);
-
verbose (
false)
Emit extra logging from Baseline and its modules. -
multilingual (
false)
Turn on the multilang module. Activation is explicit: all three ofoptions.multilingual: true,settings.defaultLanguage, and a non-emptysettings.languagesare required. Nothing is inferred. -
sitemap (
true)
Generate XML sitemaps. Set tofalseif you produce sitemaps elsewhere. -
navigator (
truein development,falseotherwise)
Register debug globals and the optional/navigator-core.htmlintrospection template. Boolean toggles both. Object form{ template, inspectorDepth }tunes them independently:template(boolean) controls whether the page renders,inspectorDepth(integer, default4) sets how deep the_inspectfilter walks. See the navigator module for the surface. -
head.titleSeparator (
' – ')
String placed between the page title and the site title in<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 - eight
_*keys initialised to{}so module-namespaced data can merge cleanly. See Globals. _baseline.env- name, package, version, andmode(read fromprocess.env.ELEVENTY_ENV).- Date global - a
datefunction exposed to templates. - HtmlBasePlugin - sets
baseHreffromprocess.env.URLorpathPrefix. _baseline.features- flags reflecting the resolved options.- Virtual directories - synthesises the
assetsandpublickeys oneleventyConfig.directories. See Config export for the asymmetry with the on-diskstatic/folder. - Passthrough copy - mounts the
publicvirtual directory at the site root/. _baseline.paths- resolved input, output, includes, data, assets, and public directories.- Drafts preprocessor - skips pages with
draft: truewhenELEVENTY_RUN_MODE === 'build'. Guarded: if you have already registered adraftspreprocessor, 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-contex | 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.
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
- Site settings - the
settingsargument. - Config export - the directory contract.
- Globals -
_baseline,_pageContext,_snapshot, and the reserved keys. - Page context - what the registry exposes.
- Internals - registry, stores, virtual dirs, driver seam.
Previous: Core reference
Next: Site settings