Eleventy Plugin Baseline

A magic carpet ride

Table of Contents

Filters

Baseline registers these filters when you add the plugin:

  • markdownify: render inline markdown to HTML. Raw HTML in the input is passed through, not escaped.
  • relatedPosts: returns the collection with the current page excluded.
  • isString: simple type guard.
  • Multilang (from multilang-core):
    • i18nTranslationsFor(page, collections.translations) — all siblings for the page’s translationKey.
    • i18nTranslationIn(page, collections.translations, lang) — specific language variant or null.
    • i18nDefaultTranslation(page, collections.translations) — default-language variant or null.
  • Debug: _inspect, _json, _keys (useful during development).

Use them in templates as you would any Eleventy filter:

{{ "# Hello" | markdownify }}

{% asyncEach item in collections.services | relatedPosts %}
  {% include "partials/related-card.njk" %}
{% endeach %}

Multilang examples:

{# all translations for current page #}
{% set translations = page | i18nTranslationsFor(collections.translations) %}

{# specific locale #}
{% set nl = page | i18nTranslationIn(collections.translations, "nl") %}

{# default locale #}
{% set canonical = page | i18nDefaultTranslation(collections.translations) %}

Previous: Globals

Next: Shortcodes