Build Awesome Eleventy Blades plugin

Ultimate blade kit for 11ty (Build Awesome).


Table of Contents

Install

npm install @anyblades/eleventy-blades

Then choose one of the following options:

A. All-in managed by Eleventy Blades:

Consider symlinking entire eleventy.config.js as a set-and-forget zero-config zero-maintenance solution:

ln -s ./node_modules/@anyblades/eleventy-blades/src/eleventy.config.js

Learn more: /11ty/tools/#base-config

Living examples:

B. Base config by Eleventy Blades with overrides in eleventy.config.js:
import baseConfig from "@anyblades/eleventy-blades/base-config";

export default function (eleventyConfig) {
  baseConfig(eleventyConfig);

  // Your additions/overrides
  ...
}

Living example: /johnheenan/minform/blob/main/eleventy.config.js

C. Plug-in Eleventy Blades in existing eleventy.config.js:
import eleventyBladesPlugin from "@anyblades/eleventy-blades";

export default function (eleventyConfig) {
  eleventyConfig.addPlugin(eleventyBladesPlugin, {
    mdAutoRawTags: true,
    mdAutoNl2br: true,
    autoLinkFavicons: true,
    siteData: true,
    filters: ["attr_set", "attr_concat", ...],
  });
}
D. Individual imports from Eleventy Blades in eleventy.config.js:
import { siteData, mdAutoRawTags, mdAutoNl2br, autoLinkFavicons, attrSetFilter, attrConcatFilter, ... } from "@anyblades/eleventy-blades";

export default function (eleventyConfig) {
  siteData(eleventyConfig);
  mdAutoRawTags(eleventyConfig);
  mdAutoNl2br(eleventyConfig);
  autoLinkFavicons(eleventyConfig);
  attrSetFilter(eleventyConfig);
  attrConcatFilter(eleventyConfig);
  ...
}
E. Included with

Minimal starters based on Eleventy Blades plugin

View more


Documentation

Filters by Eleventy Blades plugin

A collection of useful Eleventy filters for Nunjucks/Liquid via Eleventy Blades plugin.

View more

Processors by Eleventy Blades plugin

A collection of useful Eleventy processors via Eleventy Blades plugin.

View more

Power tools by Eleventy Blades

View more


Templating tricks

Blades HTML

Generic Nunjucks/Liquid templates for 11ty/Build Awesome, Jekyll, Shopify, etc.

View more

Render subnavigation (subpages)

Using /docs/plugins/navigation/#example-get-just-one-branch :

{% set _ = collections.all
  | eleventyNavigation(eleventyNavigation.key) %}{# child becomes parent here :) #}
{{ _ | eleventyNavigationToHtml }}

Include and render .md file w/o its Front Matter

{# first, get the raw content using `html` as plain-text engine #}
{% set _eval = "{% renderFile './YOUR_FILE.md', {}, 'html' %}" %}
{% set _raw_md = _eval | renderContent('njk') %}

{# then, remove the front matter using regex, and render using `md` #}
{{ _raw_md | replace(r/^---[\s\S]*?---/, '') | renderContent('md') | safe }}

Render content inline with global 11ty processors

{% capture _ %}
...
{% endcapture %}
{{ _ | markdownify | renderTransforms: page | replace: '...', '...' }}

More

Minimal starters based on Eleventy Blades plugin

View more

Awesome list

https://github.com/anyblades/awesome-11ty-build-awesome

View more


Featured by: