Hello everyone,
I am encountering an issue with Hugo where I am trying to dynamically bind data to the data-ng-src
attribute, like this:
<label data-ng-attr-for="{{"{{col.id}}"}}">
<img class="sticker" data-ng-src="{{"{{col.id}}"}}.png" alt="filled" />
</label>
However, Hugo is escaping {{col.id}}
, turning it into %7b%7bcol.id%7d%7d.png
, which prevents the image from being displayed correctly. The generated HTML looks like this:
<label data-ng-attr-for="{{col.id}}">
<img class="sticker" data-ng-src="%7b%7bcol.id%7d%7d.png" alt="filled" />
</label>
Things I Have Tried:
- Directly using the
{{"{{col.id}}"}}
syntax, but it still gets escaped. - Trying
safeHTML
andhtml
pipelines, but the issue persists. - Manually inserting the dynamic
{{col.id}}
value in the code, but Hugo seems to always escape attributes likesrc
andhref
.
Expected Solution:
I want to prevent Hugo from escaping {{col.id}}
within data-ng-src
without resorting to JavaScript. Is there a way to render the dynamic value correctly without it being escaped into %7b%7bcol.id%7d%7d
?
Any suggestions or solutions would be greatly appreciated!
Thank you for your help!