EnglishNederlandsFrançais Toggle theme

Eleventy Baseline

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

Globals

Baseline registers a handful of global data keys and one Nunjucks global. Most of them are reference targets you can read in templates; the rest are reserved namespaces that keep module-namespaced data from colliding with filters.


_baseline

The plugin's runtime introspection object. Built in three additive merges as the entry point runs:

const env = {
	_baseline: {
		env: { name, package, version, mode },
		features: {
			verbose,
			multilang,
			sitemap,
			navigator,
			head: { titleSeparator, showGenerator },
			assets: { esbuild },
			hasImageTransformPlugin
		},
		paths: { input, output, includes, data, assets, public }
	}
};

_baseline.env

Key Type Source
name string 'Eleventy Baseline'
package string npm package name
version string npm package version
mode string process.env.ELEVENTY_ENV

A note on mode: it reflects ELEVENTY_ENV, not Eleventy's own ELEVENTY_RUN_MODE. The two are different signals: ELEVENTY_ENV is the environment your process started in (development, production, whatever you set), while ELEVENTY_RUN_MODE is what Eleventy is doing right now (build, serve, watch). Baseline uses the former for activation defaults (e.g. navigator on in dev). The latter shows up in the drafts preprocessor. They have caught people out before; reach for the one that names the signal you mean.

_baseline.features

Resolved option flags. Reflects what Baseline decided after merging your options argument with defaults.

Key Type Notes
verbose boolean Mirrors options.verbose.
multilang boolean See note on naming below.
sitemap boolean Mirrors options.sitemap.
navigator boolean | object Mirrors options.navigator (boolean shorthand or { template, inspectorDepth } object form).
head.titleSeparator string | undefined Set if you provided one; otherwise undefined here, with the head module applying its own default (' – ') at module-init time.
head.showGenerator boolean | undefined Set if you provided one; otherwise undefined here, with the head module defaulting to false at module-init time.
assets.esbuild object Forwarded to esbuild verbatim.
hasImageTransformPlugin boolean Detected via eleventyConfig.hasPlugin('eleventyImageTransformPlugin').

A naming nit worth flagging: the user-facing option is multilingual, but the resolved state key is multilang (short form). The features object reflects state, so you read _baseline.features.multilang even though you wrote options.multilingual.

_baseline.paths

Resolved directory paths from eleventyConfig.directories. Read-only; useful for filters and shortcodes that need to know where things live on disk.

| Key | Default | Notes | | ---------- | ----------- | ------------------------------------------------------------------------------ | ---------------- | | input | src | | | output | dist | | | includes | _includes | | | data | _data | | | assets | assets | The assets virtual directory. | | public | static | The public virtual directory; on-disk folder is static/. See Config export. |

If you previously used _baseline.assets.input or _baseline.assets.output, those keys moved. They are now _baseline.paths.assets (a directory path) and _baseline.paths.output. The shape changed in the audit; old references will need updating.


_pageContext

A normalised per-page object built at cascade-time and exposed to every page. One sentence here, full surface on its own page: see Page context.


_snapshot

A debugging snapshot populated by the navigator module. Available when navigator is active (default in development). Exposes:

  • _snapshot.contentMap - Eleventy's content map at the time the navigator template renders.
  • _snapshot.pageContext - every page-context object the registry has built so far.

Read at module-init in templates that want to introspect the build. See the navigator module for the full picture; the navigator template at /navigator-core.html is the canonical consumer.

_snapshot.contentMap is null while the navigator template itself renders, because the template renders before Eleventy emits eleventy.contentMap. Reading _snapshot from any other page sees the populated value.


Reserved-but-empty keys

The entry point reserves five additional _* keys as empty objects:

  • _assets
  • _head
  • _multilang
  • _navigator
  • _sitemap

They exist so module-namespaced data can merge cleanly without colliding with same-named filters. No module currently writes into them; if you see one of these in a _data dump, it's {} by design.

Together with _baseline, _pageContext, and _snapshot, that is eight reserved keys. The full list lives in INTERNAL_KEYS in the entry point. See Internals.


See also

Previous: Filters

Next: Image shortcode