I’ve just upgraded to the newest Hugo version from v0.53. My project builds successfully and there are no errors, but my schema.org scripts are all rendering incorrectly.
Here’s an example of how my code rendered in v0.53:
<script type="application/ld+json">{
"@context": "https://schema.org",
"@type": "Book",
"name" : "Sapiens: A Brief History of Humankind",
"author": [
{"@type": "Person", "name": "Yuval Noah Harari"}
],
"url" : "http://localhost:1313/books/sapiens/"
}</script>
Here’s how it renders in v0.55.6
<script type="application/ld+json">"{\n \"@context\": \"https://schema.org\",\n \"@type\": \"Book\",\n \"name\" : \"Sapiens: A Brief History of Humankind\",\n \"author\": [\n \n \n {\"@type\": \"Person\", \"name\": \"Yuval Noah Harari\"\n }],\n \"url\" : \"http://localhost:1313/books/sapiens/\"}"</script>
My code:
layouts > book > single.html
<script type="application/ld+json">{{partial "schema-book.html" . }}</script>
layouts > partials > schema-book.html
"@context": "https://schema.org",
"@type": "Book",
"name" : {{.Title | jsonify}},
"author": [
{{range $i, $e := .Params.authors}}
{{if $i}}, {{end}}
{"@type": "Person", "name": {{$e | jsonify}}
}{{end}}],
"url" : {{.Permalink | jsonify}}
}
It also renders my other schema files incorrectly. They are of a similar structure, but also contain the following:
"description":
"{{$content := print "<p>" (partial "description.html" .) "</p>"}}
{{$content | safeHTML}}"
which shows up as:
"description": "\x3cp\Product is is available in all stores.\x3c\/p\x3e"
Before it was:
"description": "Product is is available in all stores."