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:

Thanks for reading!

Did you find this post useful? Let me know on Twitter! If you found an issue with the content, submit a pull request!

Subscribe to my newsletter to know when I publish more content in the future.

❤️ Likes: 0
📣 Retweets: 0
💬 Replies: 0
🙊 Mentions: 0