Skip to content

Commit 85abd20

Browse files
committed
layouts: Fix more structured data escaping issues
I think we actually only need to quote string literals. Otherwise, it seems that Hugo automatically adds quoting for us, and doesn't use funny escaping of URLs, special characters, etc.
1 parent 9e0b000 commit 85abd20

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

layouts/_default/list.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
"@context": "http://schema.org",
55
"@type": "Blog",
66
{{- /* Google recommends the headline be no more than 110 characters */}}
7-
"headline": "{{ substr .Site.Title 0 110 }}",
8-
"url" : "{{ printf "%s" .Permalink }}",
7+
"headline": {{ substr .Site.Title 0 110 }},
8+
"url" : {{ printf "%s" .Permalink }},
99
"author": {
1010
"@type": "Person",
11-
"name": "{{ .Site.Params.author }}"
11+
"name": {{ .Site.Params.author }}
1212
},
1313
{{- $ISO8601 := "2006-01-02T15:04:05-07:00" }}
1414
{{- if not .Date.IsZero }}

layouts/_default/single.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"@context": "http://schema.org",
77
"@type": "BlogPosting",
88
{{- /* Google recommends the headline be no more than 110 characters */}}
9-
"headline": "{{ substr .Title 0 110 }}",
9+
"headline": {{ substr .Title 0 110 }},
1010
{{- with .Params.images -}}{{ range first 1 . }}
1111
"image": {
1212
"@type": "ImageObject",
13-
"url": "{{ . | absURL }}"
13+
"url": {{ . | absURL }}
1414
{{- /* Don't try to get imageConfig if image param is not local */ -}}
1515
{{- if not (or (hasPrefix . "http://") (hasPrefix . "https://")) -}}
1616
{{- with (imageConfig (printf "/static/%s" .)) -}}
@@ -21,7 +21,7 @@
2121
{{ end }}
2222
},
2323
{{- end -}}{{ end }}
24-
"url": "{{ printf "%s" .Permalink }}",
24+
"url": {{ printf "%s" .Permalink }},
2525
"wordCount": "{{ .WordCount }}",
2626
{{- $ISO8601 := "2006-01-02T15:04:05-07:00" }}
2727
{{- if not .PublishDate.IsZero }}
@@ -34,7 +34,7 @@
3434
{{- end }}
3535
"author": {
3636
"@type": "Person",
37-
"name": "{{ .Params.author | default .Site.Params.author }}"
37+
"name": {{ .Params.author | default .Site.Params.author }}
3838
}
3939
{{- if or (.Params.keywords) (or (.Params.categories) (.Params.tags)) -}}
4040
,

0 commit comments

Comments
 (0)