Modifier: wrap


Wraps a string with a given HTML tag. Has the nice benefit of returning null if there is no data, eliminating the need for simple {{ if }} wrappers.

title: As the World Turns
{{ title | wrap:h1 }}
<h1>As the World Turns</h1>

You may also use Emmet-style CSS classes to be added to the tag.

{{ title | wrap:h1.fast.furious }}
<h1 class="fast furious">As the World Turns</h1>

Additional Reading

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

Last modified on August 10, 2017