Hello!
I’m (very) new to Grav and I’m having some trouble with the meta tags. Tags with single quotes and ampersands are rendering the HTML code instead of the character I need (ex. How to Inspect a Car's Interior & Exterior). Can anyone point me in the right direction to fix this?
Thank you!
What does your twig file look like?
My title tag looks like this
<title>{% if page.metadata.title.content %}{{ page.metadata.title.content|e('html') }} | {% elseif header.title %}{{ header.title|e('html') }} | {% endif %}{{ site.title|e('html') }}</title>
I’m trying to add an {{% autoescape %}
to the title tag, and it works in the header.title case, but not in the page.metadata.title.content case
I figured it out! If anyone is looking for the solution hopefully this can help them
`{% if page.metadata.title.content %}{% autoescape false %}<title>{{ page.metadata.title.content|raw|replace({''' : '\'', '&' : '&'}) }} | {{ site.title|e('html') }}</title>{% endautoescape %}{% elseif header.title %}{% autoescape %}<title>{{ header.title|e('html') }} | {{ site.title|e('html') }}</title>{% endautoescape %}{% endif %}`