Template filters

The helper functions Project Broadsheet registers with Eleventy. Use them inside any Nunjucks template with the pipe syntax (`{{ value | filter }}`).

Customization & Development Updated April 17, 2026 v1.0.0

Filters are small, reusable helper functions you call from templates with a pipe: {{ my_value | my_filter }}. Project Broadsheet registers a set of filters useful for publishing. They're all defined in eleventy.config.js and available in every template.

Built-in filters

FilterPurposeExample
yearCurrent four-digit year`{{ ''
readableDateFormat a date as "April 17, 2026"`{{ post.date
htmlDateStringFormat a date as YYYY-MM-DDUsed in <time> elements
headFirst N items of an array`{{ collections.posts
striptagsRemove HTML tagsUseful for RSS descriptions
readingTimeEstimate minutes to read`{{ content
rejectattrFilter an array by attribute`{{ posts
truncateTrim to N characters`{{ description
slugifyConvert text to a URL slug`{{ title
whereFilter an array by key/value`{{ docs
splitSplit a string into an array`{{ "a,b,c"

Adding a custom filter

Open eleventy.config.js and register a filter with addFilter:

eleventyConfig.addFilter("uppercase", (str) => {
  return String(str).toUpperCase();
});

Use it immediately:

{{ "hello" | uppercase }}

The dev server hot-reloads config changes — no restart needed.

Chaining filters

Filters can be chained, and they pass the result left-to-right:

{{ content | striptags | truncate(160) }}

That strips HTML first, then truncates to 160 characters.

Filters with arguments

Arguments go in parentheses:

{{ posts | head(5) }}
{{ title | truncate(80) }}
{{ docs | where("category", "design") }}

Shortcodes vs. filters

Filters transform a value. Shortcodes render larger blocks of HTML and may take many arguments. For bigger pieces of rendering, use a shortcode (defined with addShortcode) or an include.

What to do next

Still need help?

Browse Support for community channels and paid support options, or book a call if you'd like me to set it up for you.