Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Injection of content by string #29

Closed
rodrigo-brito opened this issue Jun 23, 2017 · 2 comments
Closed

Injection of content by string #29

rodrigo-brito opened this issue Jun 23, 2017 · 2 comments
Labels

Comments

@rodrigo-brito
Copy link

Hi,

I'm trying to inject some metatags in the template without scape. This tags was generate by a library in Go that returns a output in string. But the output always is scaped.
Code:

{% func LinkingDataLocal(datalist jsonld.StructuredDataList) %}
        {% for _, tag := range datalist %}
            <script type="application/ld+json">{%s tag.JSON() %}</script>
        {% endfor %}
{% endfunc %}

Output:

<script type="application/ld+json">{&quot;@context&quot;:&quot;http://schema.org/&quot;,&quot;@type&quot;:&quot;WebSite&quot;,&quot;name&quot;:&quot;Some Description&quot;,&quot;url&quot;:&quot;https://www.example.com&quot;}</script>

I tried other scapes {%=h..., {%=jh`, etc... but don't work too.

@valyala
Copy link
Owner

valyala commented Jun 23, 2017

@rodrigo-brito , just use {%s= tag.JSON() %} instead of {%s tag.JSON() %}

@rodrigo-brito
Copy link
Author

Thank you! Works 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants