2

So I have an include file.

<noscript>
  <img
    src="{{ srcImage }}"
    alt="{{ alt }}"
  />
</noscript>

I am including like standard:

{% include '_includes/partials/image-noscript' %

but for some reason it is generating the code like so…

<noscript>
  &lt;img
    src="http://plowmancraven-v4.loc/imager/uploads/images/general/3172/PC-Enviro-Generic-London-shutterstock_370946690_3488bcae28a5a46889970c4f238b0c7c.jpg"
    alt="PC Enviro Generic London"
  /&gt;
</noscript>

Edit: Here are some of the things I have tried but nothing has solved this issue yet.

{%- include '_includes/partials/image-noscript' -%}
{% autoescape false %}{% include '_includes/partials/image-noscript' %}{% endautoescape %}

inside the included file:

<noscript><img src="{{ srcImage }}" alt="{{ alt }}" /></noscript>

{% spaceless %}<noscript><img src="{{ srcImage }}" alt="{{ alt }}" /></noscript>{% endspaceless %}

{% autoescape false %}
<noscript>
  <img
    src="{{ srcImage }}"
    alt="{{ alt }}"
  />
</noscript>
{% endautoescape %}

{% autoescape false %}<noscript>{% endautoescape %}
{% autoescape false %}
  <img
    src="{{ srcImage }}"
    alt="{{ alt }}"
  />
{% endautoescape %}
{% autoescape false %}</noscript>{% endautoescape %}

1 Answer 1

4

It's escaping the text in the default (html) context, which should not be happening for a template you include

I suspect this is due to a larger issue, as templates that are included should not be escaped in this manner.

You can change the escaping strategy using block tags around the code, though:

{% autoescape false %}
{% endautoescape %}

cf: autoescape

2
  • Unfortunately this hasn't resolved the issue. I have updated my original question with the variations I have tried. Any other ideas would be appreciated. Commented Mar 26, 2018 at 11:52
  • If that doesn't work, something else is deeply wrong here. Commented Mar 28, 2018 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.