fix(SEO): some bad escape sequence in JSON-LD part 2 (#202)

* fix(SEO): some bad escape sequence in JSON-LD part 2

* fix(SEO): some bad escape sequence in JSON-LD Part 2

Co-authored-by: Dillon <dillonzq@outlook.com>
This commit is contained in:
Carlos Manuel Soares
2020-04-22 18:31:22 +01:00
committed by GitHub
parent d90a2d9406
commit 919f559fd0

View File

@@ -29,11 +29,11 @@
{{- with .Site.Author.name -}} {{- with .Site.Author.name -}}
"author": { "author": {
"@type": "Person", "@type": "Person",
"name": "{{ . | safeJS }}" "name": {{ . | safeHTML }}
}, },
{{- end -}} {{- end -}}
{{- with .Site.Params.description -}} {{- with .Site.Params.description -}}
"description": "{{ . | safeJS }}", "description": {{ . | safeHTML }},
{{- end -}} {{- end -}}
{{- with $params.seo.image -}} {{- with $params.seo.image -}}
"image": "{{ .url | absURL }}", "image": "{{ .url | absURL }}",
@@ -42,9 +42,9 @@
"thumbnailUrl": "{{ .url | absURL }}", "thumbnailUrl": "{{ .url | absURL }}",
{{- end -}} {{- end -}}
{{- with .Site.Copyright -}} {{- with .Site.Copyright -}}
"license": "{{ . | safeJS }}", "license": "{{ . | safeHTML }}",
{{- end -}} {{- end -}}
"name": "{{ .Site.Title | safeJS }}" "name": {{ .Site.Title | safeHTML }}
} }
</script> </script>
@@ -54,7 +54,7 @@
{ {
"@context": "http://schema.org", "@context": "http://schema.org",
"@type": "BlogPosting", "@type": "BlogPosting",
"headline": "{{ .Title | safeJS }}", "headline": {{ .Title | safeHTML }},
"inLanguage": "{{ .Site.LanguageCode }}", "inLanguage": "{{ .Site.LanguageCode }}",
"mainEntityOfPage": { "mainEntityOfPage": {
"@type": "WebPage", "@type": "WebPage",
@@ -75,20 +75,20 @@
"wordcount": {{ .WordCount }}, "wordcount": {{ .WordCount }},
"url": "{{ .Permalink }}", "url": "{{ .Permalink }}",
{{- if not .PublishDate.IsZero -}} {{- if not .PublishDate.IsZero -}}
"datePublished": "{{ .PublishDate.Format "2006-01-02" }}", "datePublished": {{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTML }},
{{- else if not .Date.IsZero -}} {{- else if not .Date.IsZero -}}
"datePublished": "{{ .Date.Format "2006-01-02" }}", "datePublished": {{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }},
{{- end -}} {{- end -}}
{{- with .Lastmod -}} {{- with .Lastmod -}}
"dateModified": "{{ .Format "2006-01-02" }}", "dateModified": {{ .Format "2006-01-02T15:04:05-07:00" | safeHTML }},
{{- end -}} {{- end -}}
{{- with .Site.Copyright -}} {{- with .Site.Copyright -}}
"license": "{{ . | safeJS }}", "license": {{ . | safeHTML }},
{{- end -}} {{- end -}}
{{- with $params.seo.publisher -}} {{- with $params.seo.publisher -}}
"publisher": { "publisher": {
"@type": "Organization", "@type": "Organization",
"name": "{{ .name | safeJS }}", "name": "{{ .name }}",
"logo": { "logo": {
"@type": "ImageObject", "@type": "ImageObject",
"url": "{{ .logo.url | absURL }}", "url": "{{ .logo.url | absURL }}",
@@ -100,10 +100,10 @@
{{- with .Params.author | default .Site.Author.name | default (T "author") -}} {{- with .Params.author | default .Site.Author.name | default (T "author") -}}
"author": { "author": {
"@type": "Person", "@type": "Person",
"name": "{{ . | safeJS }}" "name": {{ . | safeHTML }}
}, },
{{- end -}} {{- end -}}
"description": "{{ .Description | safeJS }}" "description": {{ .Description | safeHTML }}
} }
</script> </script>
{{- end -}} {{- end -}}