Table of Contents
Plugin entrypoint
How to add Baseline to Eleventy, what it registers, and the options you can pass.
Baseline setup has two parts: add the plugin in your Eleventy config callback, then export the config object using Baseline's defaults. This page covers the first part. For the exported config, see Config object defaults.
Default usage
import baseline, { config as baselineConfig } from '@apleasantview/eleventy-plugin-baseline';
/** @param {import("@11ty/eleventy").UserConfig} eleventyConfig */
export default async function (eleventyConfig) {
eleventyConfig.addPlugin(baseline());
}
export const config = baselineConfig;
Options
Pass options to baseline():
eleventyConfig.addPlugin(
baseline({
verbose: false,
enableNavigatorTemplate: false,
enableSitemapTemplate: true
})
);
-
verbose (
false) — emit extra logging from Baseline and its modules. -
enableNavigatorTemplate (
false) — register the navigator virtual template at/navigator-core.html. Debug globals (_navigator,_context) are always available regardless. Accepts[true, depth]to set a custom inspector depth (default2). -
enableSitemapTemplate (
true) — generate XML sitemaps. Turn off if you manage sitemaps elsewhere. -
multilingual (
false) — enable multilang-core. RequiresdefaultLanguageand a non-emptylanguagesmap. All three must be set for the module to load. -
defaultLanguage (
string) — IETF/BCP47 default language code (e.g.'en'). Required whenmultilingualis true. -
languages (
object | string[]) — language definitions. Object{ en: {}, fr: {} }or array['en', 'fr']. Arrays are normalized to objects; invalid entries are dropped (logged ifverbose: true). Required whenmultilingualis true. -
assetsESBuild (
{}) — options forwarded to assets-esbuild. Module defaults (minify, ES2020 target) apply inside the process function.
What Baseline registers
Everything below is registered when you add the plugin. No extra setup needed.
Registration order matters — listed here in the order they appear in the entry point:
-
multilang-core (conditional) — language collections, hreflang, i18n filters. Only when
multilingual: truewith validdefaultLanguageandlanguages. -
HtmlBasePlugin — sets
baseHreffromprocess.env.URLorpathPrefix. -
assets-core — asset pipeline orchestrator. Registers
assets-esbuildandassets-postcssfor JS/CSS processing. Adds_baseline.assetsto global data. -
head-core — enables
<baseline-head>for HTML head injection via PostHTML. -
sitemap-core — XML sitemap generation. Multilingual sites get per-language sitemaps plus an index.
-
Filters —
markdownify,relatedPosts,isString. -
Shortcode:
image— responsive<picture>via@11ty/eleventy-img. UsestransformOnRequestfor faster dev startup. See Image shortcode. -
Image dev server — on-demand image generation during
--serveviaeleventyImageOnRequestDuringServePlugin. -
Debug filters —
_inspect,_json,_keys— handy during template development. -
navigator-core — debug globals (
_navigator,_context) and optional virtual page. Registered last.
Globals, passthrough, drafts
_baselineglobal — a curated object withversion,name,verbose,hasImageTransformPlugin. Not the full options bag. See Globals for the full shape.hasImageTransformPlugin— detected viaeleventyConfig.hasPlugin()before options are built. Not a user option.- Passthrough copy —
./src/staticcontents copied to site root/. - Draft preprocessor — skips
draft: truepages whenELEVENTY_RUN_MODE === "build". Guarded against double-registration — if you define your own drafts preprocessor, Baseline won't overwrite it.
Plugin metadata
Sets plugin.name to @apleasantview/eleventy-plugin-baseline so eleventyConfig.hasPlugin() can detect it.
Not included
HTML image transform (eleventyImageTransformPlugin) is not bundled — add it yourself if you need content-level <img> rewrites. Baseline's image shortcode works either way.
Customize safely
Start from baselineConfig and merge if you change dirs, engines, or formats, so assets, head, and sitemap modules continue to work. See Config object defaults.
Previous: References
Next: Config object defaults