Table of Contents
Baseline plugin reference
Reference walkthrough of the Baseline plugin. This mirrors @apleasantview/eleventy-plugin-baseline/eleventy.config.js in code order.
Purpose
- Defines the Baseline plugin (options, modules, filters/shortcodes) and exports the Eleventy config defaults (
baselineConfig).
Version check and options
versionCheck(">=3.0")warns if Eleventy is too old.userOptionsdefaults:verbose(false),enableNavigatorTemplate(false),enableSitemapTemplate(true)assets.esbuild({ minify: true, target: "es2020" })multilingual(false),defaultLanguage,languages(required when multilingual is on)- Tracks
hasImageTransformPlugin
- Multilang guard: requires
defaultLanguage+ non-emptylanguagesmap. filterAllCollection(true): when enabled, Baseline attempts to filter out*.11tydata.jsitems fromcollections.all. This is a side-effect ofassets-esbuild.
Globals, passthrough, drafts
- Adds global
_baselinewith resolved options. - Passthrough copy:
./src/static→/. - Draft preprocessor: skips
draft: truewhenELEVENTY_RUN_MODE === "build"; you can override this in your own config if needed.
Modules registered
HtmlBasePlugin:baseHreffromprocess.env.URLorpathPrefix.- Assets:
assets-core,assets-postcss,assets-esbuild(withassets.esbuildoptions). - Head:
head-core(enables<baseline-head>). - Sitemap:
sitemap-core(template on by default; multilingual-aware). - Navigator:
navigator-core(debugging template (off by default) and debug globals). - Multilang:
multilang-corewhenmultilingualis true and languages provided.
Filters, shortcodes, debug
- Filters:
markdownify,relatedPosts,isString. - Debug filters:
_inspect,_json,_keys. - Shortcode:
image.
Dev server
- Adds
eleventyImageOnRequestDuringServePluginfor on-request image generation during serve.
Plugin metadata
- Sets
plugin.nameexplicitly to@apleasantview/eleventy-plugin-baselinesoeleventyConfig.hasPlugin()can detect it.
Exported config defaults
export const config = {
dir: {
input: 'src',
output: 'dist',
data: '_data',
includes: '_includes',
assets: 'assets'
},
htmlTemplateEngine: 'njk',
markdownTemplateEngine: 'njk',
templateFormats: ['html', 'njk', 'md']
};
Not included
- HTML image transform plugin (
eleventyImageTransformPlugin) wiring; add it yourself if you need content-level<img>rewrites.
Customize safely
- Start from
baselineConfigand merge if you change dirs/engines/formats so assets/head/sitemap continue to work.
Previous: References
Next: Plugin entrypoint