1
0
mirror of https://github.com/alanorth/hugo-theme-bootstrap4-blog.git synced 2024-12-19 00:52:19 +01:00

layouts: Remove quoting of structured data

I don't understand it, but quoting these values causes Hugo to use
escape codes for non-ASCII (?) characters. For example:

  "description": "A thriving oasis in Jordan\x27s desert is at risk of disappearing."

Google's Search Console shows the following error:

    Unparsable structured data > Bad escape sequence in string

We had a similar issue with dates that was fixed in #111 and the
solution is the same here.
This commit is contained in:
Alan Orth 2020-03-19 15:22:29 +02:00
parent 780444bfb0
commit 4a88be4434
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
2 changed files with 4 additions and 4 deletions

View File

@ -15,10 +15,10 @@
"dateModified": {{ .Date.Format $ISO8601 }},
{{- end }}
{{- /* all of the site's categories/tags, from Hugo's tpl/template_embedded.go */}}
"keywords": "{{ range $plural, $terms := .Site.Taxonomies }}{{ range $term, $val := $terms }}{{ printf "%s," $term }}{{ end }}{{ end }}"
"keywords": {{ range $plural, $terms := .Site.Taxonomies }}{{ range $term, $val := $terms }}{{ printf "%s," $term }}{{ end }}{{ end }}
{{- with .Site.Params.description -}}
,
"description": "{{- . -}}"
"description": {{- . -}}
{{- end }}
}
</script>

View File

@ -38,12 +38,12 @@
}
{{- if or (.Params.keywords) (or (.Params.categories) (.Params.tags)) -}}
,
"keywords": "{{ delimit (union .Params.keywords (union .Params.categories .Params.tags)) ", " }}"
"keywords": {{ delimit (union .Params.keywords (union .Params.categories .Params.tags)) ", " }}
{{- end }}
{{- with .Params.description -}}
,
"description": "{{ . }}"
"description": {{ . }}
{{- end }}
}
</script>