Hi Grav community,
I cannot find any solution for how to add to head from page content. I’m try with TWIG assets.addInlineJs, but I get error 0 - Unexpected character “@”, because of the JSON.
Thanks in advance.
Blaz
Hi Grav community,
I cannot find any solution for how to add to head from page content. I’m try with TWIG assets.addInlineJs, but I get error 0 - Unexpected character “@”, because of the JSON.
Thanks in advance.
Blaz
addInlineJs
only accepts a javascript string, not a <script>
tag containing it. You can add {{page.header.header_script}}
to the theme’s base.html.twig
template, before the </head>
, and add header_script: '<script type="application/ld+json">test</script>'
into your page header.