Eleventy Blades

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 your additions/overrides in eleventy.config.js:

import baseConfig from "@anyblades/eleventy-blades/base-config";

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

  // Your additions/overrides
  ...
}

Living example: /hostfurl/minformhf/blob/main/eleventy.config.js

C. Plug-in Eleventy Blades in your 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 your 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);
  ...
}

Or use a fully preconfigured template as an alternative option:


Featured by:


Build Awesome Filters by Eleventy Blades

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

View more


Build Awesome Processors by Eleventy Blades

A collection of useful Eleventy processors via Eleventy Blades plugin.

View more


Build Awesome Power tools by Eleventy Blades

View more


Appendix: Templating

Blades HTML templates

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

View more

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: '...', '...' }}