0

i have this script for meta description in jinja2 :

<meta name="description" content="{{ product.description|nl2br|truncate(150) }}" />

the problem is output, have html characters :

  <meta name="description" content="10.00 $ : Features:
&lt;br /&gt;

&lt;br /&gt;
- Auto-Like
&lt;br /&gt;
- Auto-Comment
&lt;br /&gt;
- Auto-Follow
&lt;br /&gt;
- Auto-Unfollow ALL
&lt;br /&gt;
- Auto-Unfollow People who are not ..." />

need output whitout html tags, how can i remove this ?

&lt;br,&gt;
Steve
  • 1,553
  • 2
  • 20
  • 29
selfmarket.net
  • 139
  • 1
  • 2
  • 7

1 Answers1

-2

Try this one, use safe, the documentation is here.

Mark the value as safe which means that in an environment with automatic escaping enabled this variable will not be escaped.


so your code should be:

<meta name="description" content="{{ product.description | safe | nl2br | truncate(150) }}" />
lord63. j
  • 4,500
  • 2
  • 22
  • 30