mirror of
https://github.com/alanorth/hugo-theme-bootstrap4-blog.git
synced 2024-11-17 17:57:04 +01:00
layouts: Quote some parameters in JSON LD
Current Hugo 0.19-DEV doesn't quote these anymore, so we need to add quotes manually. I'm not sure if this is a design decision or not on Hugo's part.
This commit is contained in:
parent
0e5937b1b7
commit
4d7a544dac
@ -4,24 +4,24 @@
|
|||||||
"@context": "http://schema.org",
|
"@context": "http://schema.org",
|
||||||
"@type": "Blog",
|
"@type": "Blog",
|
||||||
{{/* Google recommends the headline be no more than 110 characters */}}
|
{{/* Google recommends the headline be no more than 110 characters */}}
|
||||||
"headline": {{ substr .Site.Title 0 110 }},
|
"headline": "{{ substr .Site.Title 0 110 }}",
|
||||||
"url" : {{ printf "%s" .Permalink }},
|
"url" : "{{ printf "%s" .Permalink }}",
|
||||||
"author": {
|
"author": {
|
||||||
"@type": "Person",
|
"@type": "Person",
|
||||||
"name": {{ .Site.Params.author }}
|
"name": "{{ .Site.Params.author }}"
|
||||||
},
|
},
|
||||||
{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }}
|
{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }}
|
||||||
{{ if not .Date.IsZero }}
|
{{ if not .Date.IsZero }}
|
||||||
"dateModified": {{ .Date.Format $ISO8601 }},
|
"dateModified": "{{ .Date.Format $ISO8601 }}",
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ with .Site.Social.GooglePlus }}
|
{{ with .Site.Social.GooglePlus }}
|
||||||
"publisher": {{ printf "%s" . }},
|
"publisher": "{{ printf "%s" . }}",
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{/* all of the site's categories/tags, from Hugo's tpl/template_embedded.go */}}
|
{{/* 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 }}
|
{{ with .Site.Params.description }}
|
||||||
,
|
,
|
||||||
"description": {{- . -}}
|
"description": "{{- . -}}"
|
||||||
{{ end }}
|
{{ end }}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -6,30 +6,30 @@
|
|||||||
"@context": "http://schema.org",
|
"@context": "http://schema.org",
|
||||||
"@type": "BlogPosting",
|
"@type": "BlogPosting",
|
||||||
{{/* Google recommends the headline be no more than 110 characters */}}
|
{{/* Google recommends the headline be no more than 110 characters */}}
|
||||||
"headline": {{ substr .Title 0 110 }},
|
"headline": "{{ substr .Title 0 110 }}",
|
||||||
{{- with .Params.images -}}{{ range first 1 . }}
|
{{- with .Params.images -}}{{ range first 1 . }}
|
||||||
"image": {
|
"image": {
|
||||||
"@type": "ImageObject",
|
"@type": "ImageObject",
|
||||||
"url": {{ . | absURL }}
|
"url": "{{ . | absURL }}"
|
||||||
},
|
},
|
||||||
{{- end -}}{{ end }}
|
{{- end -}}{{ end }}
|
||||||
"url": {{ printf "%s" .Permalink }},
|
"url": "{{ printf "%s" .Permalink }}",
|
||||||
"wordCount": "{{ .WordCount }}",
|
"wordCount": "{{ .WordCount }}",
|
||||||
{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }}
|
{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }}
|
||||||
{{ if not .PublishDate.IsZero }}
|
{{ if not .PublishDate.IsZero }}
|
||||||
"datePublished": {{ .PublishDate.Format $ISO8601 }},
|
"datePublished": "{{ .PublishDate.Format $ISO8601 }}",
|
||||||
{{ else }}
|
{{ else }}
|
||||||
"datePublished": {{ .Date.Format $ISO8601 }},
|
"datePublished": "{{ .Date.Format $ISO8601 }}",
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if not .Lastmod.IsZero }}
|
{{ if not .Lastmod.IsZero }}
|
||||||
"dateModified": {{ .Lastmod.Format $ISO8601 }},
|
"dateModified": "{{ .Lastmod.Format $ISO8601 }}",
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ with .Site.Social.GooglePlus }}
|
{{ with .Site.Social.GooglePlus }}
|
||||||
"publisher": {{ printf "%s" . }},
|
"publisher": "{{ printf "%s" . }}",
|
||||||
{{ end }}
|
{{ end }}
|
||||||
"author": {
|
"author": {
|
||||||
"@type": "Person",
|
"@type": "Person",
|
||||||
"name": {{ .Params.author | default .Site.Params.author }}
|
"name": "{{ .Params.author | default .Site.Params.author }}"
|
||||||
}
|
}
|
||||||
{{ if or (.Params.categories) (.Params.tags) }}
|
{{ if or (.Params.categories) (.Params.tags) }}
|
||||||
,
|
,
|
||||||
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
{{- with .Params.description -}}
|
{{- with .Params.description -}}
|
||||||
,
|
,
|
||||||
"description": {{ . }}
|
"description": "{{ . }}"
|
||||||
{{ end }}
|
{{ end }}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user