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 is escaped).
  • relatedPosts: pick related posts (see modules docs for scoring/usage).
  • 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 }}
{{ myPosts | relatedPosts(page.url, 3) }}

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) %}