Single quote does not show correctly in title social metatags

Hi,

The frontmatter is set this way:

---
title: "L'anatomie de l'oeil"
date: 2020-12-30T23:04:03+01:00
description: "Un petit résumé de l'anatomie de l'oeil"
draft: false
---

And I get in the source code from the all the social internal metatag::

<meta property="og:title" content="L&#39;anatomie de l&#39;oeil" />
<meta property="og:description" content="Un petit résumé de l&#39;anatomie de l&#39;oeil" />
<meta name="twitter:title" content="L&#39;anatomie de l&#39;oeil"/>
<meta name="twitter:description" content="Un petit résumé de l&#39;anatomie de l&#39;oeil"/>

How can I set the title to escape the single quote ?

Mamisoa

&#39 is the correct html entity for that character, so I’d say the behaviour is entirely as expected.

Why do you believe this is an issue? Browsers, and microbrowsers, will render the correct character not the html entity. If you read source code, you will see html.

Check your layout files if those attributes are properly escaped:

<meta name="twitter:title" content="{{ $somevariable | safeHTMLAttr }}" />

Should print it out properly.

Is this safe html though? This is user supplied content, so I’d suggest not. There’s a reason that Hugo escapes the html by default I imagine, security.

I still don’t see why this would be an issue in the first place. Any browser, microbrowser or feed reader will render the character as intended. I see absolutely no issue with html entities in html.