Stop "fixing" my code


Please, is it possible to make Hugo to stop trying to fix my HTML? I’ve some microtemplate code which Hugo keeps trying to fix and adding ".

<script id="tmpl-group-invites" type="text/x-jsrender">
<%for suggestions%>
  <li data-js-group-code="<%:code%>" data-js-group-id="<%:group:id%>">
    <div class="row">
      <div class="col-md-3">
        <%if invited_by.profile_picure_url%>
          <img src="<%:invited_by.profile_picure_url%>" alt=""/>
          <img src="" alt=""/>
      <div class="col-md-9">
          {{ i18n "invitedYouToGroup" }}
          <button class="trigger-invitesMenu link-accept" type="button" data-js-invitesMenu-code="<%:code%>" value="accept">{{ i18n "accept" }}</button>
          <button class="trigger-invitesMenu link-reject" type="button" data-js-invitesMenu-code="<%:code%>" value="reject">{{ i18n "refuse" }}</button>

Some of the i18n outputs are being enclosed by ". Like "refuse" instead of refuse.

Thank you.

Go templates are context (and security) aware. It can be tricky to make it happy sometimes. Try this:

{{ i18n "refuse" | safeHTML }}

Thank you, @moorereason, but I’ve already tried that. I tried safeHTML, htmlUnescape, plainify… No luck.


{{ i18n "accept" | safeJS }}

Thank you for your attention, @moorereason!

1 Like