1

I´m trying to insert dynamic links in a twig template, but when I render the page it shows the raw HTML.

I send the variables as an array ('fact' => ['tag' => '<a href="loremipsum">tag</a>']) for example) and then in the twig {{ fact.tag }}, but as mentioned it returns the raw tag.

Am I doing something wrong?

David Ansermot
  • 6,052
  • 8
  • 47
  • 82
Sslink
  • 89
  • 1
  • 9

1 Answers1

4

Here is a Twigfiddle to show that {{ fact.tag|raw }} is the correct answer. It shows both with and without the raw filter:

https://twigfiddle.com/d4hc55

Alvin Bunk
  • 7,621
  • 3
  • 29
  • 45