Posted on under Statamic by Owen Conti.
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:
1-2 type: code_block3 content:4 -5 type: text6 text: '{{ redirect to="{{ redirect_url }}" }}'
Which looks like this in the editor:
1{{ redirect to="{{ redirect_url }}" }}
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:
1<div class="content">2 {{ content }}3</div>
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:
1<div class="content">2 {{ content | noparse }}3</div>
Hopefully you found this article useful! If you did, share it on X!
Found an issue with the article? Submit your edits against the repository.