Frontmatter metadata get wrongly escaped quotes when rendered

Hi everyone,

I find myself with the following problem and I would like to know if this rings a bell to anyone:

The metadata values I set in the frontmatter of any page ends up with wrongly escaped quotes when the page is rendered.

Here is a sample of the metadata section from my page’s frontmatter:

  'og:title': Page's Title with quote
  'og:site_name': Site's name with quote

And here is what I get in the rendered page:

<meta property="og:title" content="Page&amp;apos;s Title with quote" />
<meta property="og:site_name" content="Site&amp;apos;s name with quote" />

It looks like the quote is transformed as “'” and then the “&” is escaped as “&”.

I never had any issue with rendering quotes from other frontmatter values until now.
I’m pretty sure I am missing something obvious. :slight_smile:

I’m running Grav v1.7.41.1 and here is my list of activated plugins (all up to date):

  • Breadcrumbs
  • Error
  • Flex Objects
  • Pagination
  • Problems
  • Shortcode Core
  • Simplesearch
  • Taxonomy List

Did anyone already encounter this kind of issue?

Any pointer to debug this would be much appreciated :slight_smile:

@rabooman, Using latest Grav and theme Quark, I cannot reproduce your issue.

Template /system/templates/partials/metadata.html.twig used by Quark will generate the following output using your snippet:

<meta property="og:title" content="Page&apos;s Title with quote" />
<meta property="og:site_name" content="Site&apos;s name with quote" />
1 Like

Thanks a lot for your quick answer, you solved my problem!

The theme I’m using, which is based on Quark, modified the metadata.html.twig and modified the escape filters (I don’t know why).
I had too quick of a look on the file the first time and missed this, and your comment made me look at it again.

So, thanks! :slight_smile: