Modifier: macro


Macro is a very special modifier. It performs no modifications of its own, but rather lets you create reusable groups of modifiers and give them a name. Those groups are each called a “macro” and are stored in your theme’s settings/macros.yaml file. Keep in mind that the order of modifiers within a macro matter, the same way as regular modifiers.

# /site/theme/<your_theme>/settings/macros.yaml
headline:
  title: true
  widont: true
  remove_right: .

# Page content
title: Actually i don't know what we're talking about.
{{ title | macro:headline }}
I Don't Know What We're Talking&nbsp;About

When passing multiple parameters to a modifier, you’ll need to pop down into a simple list:

# /site/theme/<your_theme>/settings/macros.yaml
excerpt:
  safe_truncate: 
    - 175
    - ...

This is equivalent to:

{{ content | safe_truncate:175:... }}

Additional Reading

Learn how to use and chain modifiers in the Antlers template guide.

Last modified on July 31, 2018