Escaping Antlers output in Statamic via the `noparse` tag

Published under Statamic.

By default, when you output content from a field into a template, Statamic will attempt to run that content through the Antlers templating language. Let's take a look at an example.

Here we have a redirect tag written in the content in Bard field:

Which looks like this in the editor:

Now, if your template outputs the field directly, Statamic will attempt to run that code as if it was a part of the template, in other words, it will attempt to redirect the page.

Example default template code:

There's an easy way to fix this so Statamic will output the code as plaintext instead of attempting to run it, using the noparse modifier:


Webmentions

❤️ Likes: 0
📣 Retweets: 0
💬 Replies: 0
🙊 Mentions: 0
Enjoyed this post? Have a comment or feedback? Let me know on Twitter!