Hugo_stats.json is missing some classes when there is somewhere an apostrophe in string

I have found that it is always best to wrap strings in backticks instead of double quotes in Go templates.

Strings wrapped in backticks are literal.
Strings wrapped in double quotes are interpreted.

This way one avoids problems like the one you encountered.

Therefore the Go comment in your template should read:

{{ `<!-- Hero Area Image d'accueil -->` | safeHTML }}

For an explanation have a look at the Go spec: String Literals

1 Like