Fixing formatting of ld+json partials for Hugo 0.55.x.

This commit is contained in:
Fredrik Jonsson 2019-05-20 23:09:13 +02:00
commit d6e4835b24
2 changed files with 19 additions and 19 deletions

View file

@ -2,28 +2,28 @@
{ {
"@context": "http://schema.org", "@context": "http://schema.org",
"@type": "WebSite", "@type": "WebSite",
"url" : "{{ .Permalink }}", "url" : {{ .Permalink }},
"name": {{ .Title | jsonify }}, "name": "{{ .Title }}",
{{ with $.Param "description" -}} {{ with $.Param "description" -}}
"description": {{ . | jsonify }}, "description": "{{ . }}",
{{ end -}} {{ end -}}
{{ with $.Param "image" -}} {{ with $.Param "image" -}}
"image" : "{{ . | absURL }}", "image" : {{ . | absURL }},
{{ end -}} {{ end -}}
{{ with $.Param "author" -}} {{ with $.Param "author" -}}
"author": { "author": {
"@type": "Person", "@type": "Person",
"name": {{ . | jsonify }} "name": "{{ . }}"
}, },
{{ end -}} {{ end -}}
"mainEntityOfPage": { "mainEntityOfPage": {
"@type": "WebPage", "@type": "WebPage",
"@id": "{{ .Site.BaseURL }}" "@id": {{ .Site.BaseURL }}
}, },
"publisher": { "publisher": {
"@type": "Organization", "@type": "Organization",
"name": {{ .Site.Title | jsonify }}, "name": "{{ .Site.Title }}",
"url": "{{ .Site.BaseURL }}" "url": {{ .Site.BaseURL }}
} }
} }
</script> </script>

View file

@ -2,31 +2,31 @@
{ {
"@context": "https://schema.org", "@context": "https://schema.org",
"@type": "BlogPosting", "@type": "BlogPosting",
"headline": {{ .Title | jsonify }}, "headline": "{{ .Title }}",
"datePublished": "{{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}", "datePublished": {{ .Date.Format "2006-01-02T15:04:05Z07:00" }},
"dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}", "dateModified": {{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }},
"url" : "{{ .Permalink }}", "url" : {{ .Permalink }},
"description": {{ with (.Description | default (replaceRE "\n" " " .Summary)) }}{{ . | jsonify }}{{ end }}, "description": {{ with (.Description | default (replaceRE "\n" " " .Summary)) }}"{{ . }}"{{ end }},
{{ with $.Param "image" -}} {{ with $.Param "image" -}}
"image" : "{{ . | absURL }}", "image" : {{ . | absURL }},
{{ end -}} {{ end -}}
{{ with .Params.tags -}} {{ with .Params.tags -}}
"keywords": {{ . | jsonify }}, "keywords": {{ . }},
{{ end -}} {{ end -}}
{{ with $.Param "author" -}} {{ with $.Param "author" -}}
"author": { "author": {
"@type": "Person", "@type": "Person",
"name": {{ . | jsonify }} "name": "{{ . }}"
}, },
{{ end -}} {{ end -}}
"mainEntityOfPage": { "mainEntityOfPage": {
"@type": "WebPage", "@type": "WebPage",
"@id": "{{ .Site.BaseURL }}" "@id": {{ .Site.BaseURL }}
}, },
"publisher": { "publisher": {
"@type": "Organization", "@type": "Organization",
"name": {{ .Site.Title | jsonify }}, "name": "{{ .Site.Title }}",
"url": "{{ .Site.BaseURL }}" "url": {{ .Site.BaseURL }}
} }
} }
</script> </script>