EnglishNederlandsFrançais Toggle theme

Eleventy Baseline

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

Site settings

settings is the first argument to baseline(). It carries site identity: title, tagline, canonical URL, indexability, languages, and any extra <head> items you want injected on every page.

Settings flow through state.settings and surface in templates as _pageContext.site (and as settings in the data cascade when you keep them in _data/settings.js).


The settings shape

export default {
	title: 'Your site',
	tagline: 'A short site-wide line.',
	url: 'https://www.example.com',
	noindex: false,
	defaultLanguage: 'en',
	languages: { en: {}, fr: {} },
	head: {
		link: [],
		script: [],
		meta: [],
		style: []
	}
};

eleventyConfig.addPlugin(baseline(settings));

Every key is optional. Baseline logs a warning if settings.url is missing because canonical URLs fall back to relative paths.

Keys

  • title (string)

    • site title. Used by the head module to compose <title> (Page title – Site title) and by the navigator template.
  • tagline (string)

    • short site-wide line. Used as the home page's title suffix and as the default <meta name="description"> when a page has no description of its own.
  • url (string)

    • absolute site URL, including protocol. Used to resolve canonical URLs, sitemap entries, and absolute image URLs in the image shortcode. Baseline warns at startup if this is missing.
  • noindex (boolean, default false)

    • when true, every page renders <meta name="robots" content="noindex, nofollow"> and the sitemap is not emitted. Useful for staging environments. Pages can also opt out individually via noindex: true in front matter.
  • defaultLanguage (string)

    • IETF/BCP47 code (e.g. 'en', 'en-GB'). Required for multilingual activation. The default-language permalinks are unprefixed; other languages live under /<lang>/.
  • languages (object | string[])

    • language map. Object form { en: {}, fr: {} } or array shorthand ['en', 'fr'] (arrays are normalised to objects with empty entries; invalid entries are dropped, logged when verbose: true). Required for multilingual activation. Per-language overrides are supported for title and tagline:
    export default {
    	languages: {
    		en: { title: 'Your site', tagline: 'A short line.' },
    		fr: { title: 'Votre site', tagline: 'Une ligne courte.' }
    	}
    };
  • head (object)

    • additive <head> extras injected on every page. Four arrays, one per element type. Each entry is an object whose keys become attributes on the rendered tag.
    export default {
    	head: {
    		link: [
    			{ rel: 'stylesheet', href: '/assets/css/index.css' },
    			{ rel: 'icon', href: '/favicon.svg' }
    		],
    		script: [{ src: '/assets/js/index.js', defer: true }],
    		meta: [{ name: 'theme-color', content: '#0a0a0a' }],
    		style: []
    	}
    };

    Pages can add their own entries through the same shape in front matter; Baseline merges and deduplicates. See the head module for the merge rules.

    This is also where you wire the asset pipeline into your pages. Baseline compiles assets/css/index.css and assets/js/index.js to /assets/css/index.css and /assets/js/index.js at the site root, but it does not auto-inject them. Declare a link and a script entry as above. The default docs site does exactly this.

    Output filenames are unhashed today. Cache-busting via hashed filenames is on the roadmap, and the entrypoint declaration shape may change to accommodate it.

    In practice link, script, and meta carry almost everything you need. style is supported for parity but rarely used; inline <style> blocks usually belong in your CSS pipeline rather than the head extras list.

Multilingual activation

Three things must be set together: options.multilingual: true, settings.defaultLanguage, and a non-empty settings.languages. Nothing is inferred. If any of the three is missing, the multilang module skips activation and logs why.

See the [[multilnag | multilang module]] for what activation enables (per-language collections, hreflang, i18n filters).

Where settings surface

Surface Reads
_pageContext.site title, tagline, url, noindex (per-language title/tagline if present)
_pageContext.meta composed <title>, default description from tagline, robots from noindex
Head module head.{link, script, meta, style} extras
Sitemap module noindex (skip when true); defaultLanguage and languages for per-lang sitemaps
Multilang module defaultLanguage, languages
Image shortcode url for absolute image URLs

See also