fix(SEO): some bad escape sequence in JSON-LD
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
baseURL = "/"
|
baseURL = "https://example.com"
|
||||||
# [en, zh-cn, fr, ...] determines default content language
|
# [en, zh-cn, fr, ...] determines default content language
|
||||||
# [en, zh-cn, fr, ...] 设置默认的语言
|
# [en, zh-cn, fr, ...] 设置默认的语言
|
||||||
defaultContentLanguage = "en"
|
defaultContentLanguage = "en"
|
||||||
|
|||||||
@@ -20,15 +20,18 @@
|
|||||||
{
|
{
|
||||||
"@context": "http://schema.org",
|
"@context": "http://schema.org",
|
||||||
"@type": "WebSite",
|
"@type": "WebSite",
|
||||||
"url": "{{ relLangURL `/` }}",
|
"url": "{{ .Permalink }}",
|
||||||
|
{{- with .Site.LanguageCode -}}
|
||||||
|
"inLanguage": "{{ . }}",
|
||||||
|
{{- end -}}
|
||||||
{{- with .Site.Author.name -}}
|
{{- with .Site.Author.name -}}
|
||||||
"author": {
|
"author": {
|
||||||
"@type": "Person",
|
"@type": "Person",
|
||||||
"name": "{{ . }}"
|
"name": "{{ . | safeJS }}"
|
||||||
},
|
},
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- with .Site.Params.description -}}
|
{{- with .Site.Params.description -}}
|
||||||
"description": "{{ . }}",
|
"description": "{{ . | safeJS }}",
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- with .Site.Params.image -}}
|
{{- with .Site.Params.image -}}
|
||||||
"image": "{{ .url | absURL }}",
|
"image": "{{ .url | absURL }}",
|
||||||
@@ -37,9 +40,9 @@
|
|||||||
"thumbnailUrl": "{{ .url | absURL }}",
|
"thumbnailUrl": "{{ .url | absURL }}",
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- with .Site.Copyright -}}
|
{{- with .Site.Copyright -}}
|
||||||
"license": "{{ . }}",
|
"license": "{{ . | safeJS }}",
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
"name": "{{ .Site.Title }}"
|
"name": "{{ .Site.Title | safeJS }}"
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -49,19 +52,13 @@
|
|||||||
{
|
{
|
||||||
"@context": "http://schema.org",
|
"@context": "http://schema.org",
|
||||||
"@type": "BlogPosting",
|
"@type": "BlogPosting",
|
||||||
"headline": "{{ .Title }}",
|
"headline": "{{ .Title | safeJS }}",
|
||||||
|
"inLanguage": "{{ .Site.LanguageCode }}",
|
||||||
"mainEntityOfPage": {
|
"mainEntityOfPage": {
|
||||||
"@type": "WebPage",
|
"@type": "WebPage",
|
||||||
"@id": "{{ .Permalink }}"
|
"@id": "{{ .Permalink }}"
|
||||||
},
|
},
|
||||||
{{- if ge (.Param "lua.image.width") 696 -}}
|
{{- if ge .Site.Params.image.width 696 -}}
|
||||||
"image": {
|
|
||||||
"@type": "ImageObject",
|
|
||||||
"url": "{{ .Param "lua.image.url" | absURL }}",
|
|
||||||
"width": {{ .Param "lua.image.width" }},
|
|
||||||
"height": {{ .Param "lua.image.height" }}
|
|
||||||
},
|
|
||||||
{{- else if ge .Site.Params.image.width 696 -}}
|
|
||||||
"image": {
|
"image": {
|
||||||
"@type": "ImageObject",
|
"@type": "ImageObject",
|
||||||
"url": "{{ .Site.Params.image.url | absURL }}",
|
"url": "{{ .Site.Params.image.url | absURL }}",
|
||||||
@@ -76,20 +73,20 @@
|
|||||||
"wordcount": {{ .WordCount }},
|
"wordcount": {{ .WordCount }},
|
||||||
"url": "{{ .Permalink }}",
|
"url": "{{ .Permalink }}",
|
||||||
{{- if not .PublishDate.IsZero -}}
|
{{- if not .PublishDate.IsZero -}}
|
||||||
"datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" }}",
|
"datePublished": "{{ .PublishDate.Format "2006-01-02" }}",
|
||||||
{{- else if not .Date.IsZero -}}
|
{{- else if not .Date.IsZero -}}
|
||||||
"datePublished": "{{ .Date.Format "2006-01-02T15:04:05-07:00" }}",
|
"datePublished": "{{ .Date.Format "2006-01-02" }}",
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- with .Lastmod -}}
|
{{- with .Lastmod -}}
|
||||||
"dateModified": "{{ .Format "2006-01-02T15:04:05-07:00" }}",
|
"dateModified": "{{ .Format "2006-01-02" }}",
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- with .Site.Copyright -}}
|
{{- with .Site.Copyright -}}
|
||||||
"license": "{{ . }}",
|
"license": "{{ . | safeJS }}",
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- with .Site.Params.publisher -}}
|
{{- with .Site.Params.publisher -}}
|
||||||
"publisher": {
|
"publisher": {
|
||||||
"@type": "Organization",
|
"@type": "Organization",
|
||||||
"name": "{{ .name }}",
|
"name": "{{ .name | safeJS }}",
|
||||||
"logo": {
|
"logo": {
|
||||||
"@type": "ImageObject",
|
"@type": "ImageObject",
|
||||||
"url": "{{ .logo.url | absURL }}",
|
"url": "{{ .logo.url | absURL }}",
|
||||||
@@ -98,13 +95,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- with .Site.Author.Name -}}
|
{{- with .Params.author | default .Site.Author.name | default (T "author") -}}
|
||||||
"author": {
|
"author": {
|
||||||
"@type": "Person",
|
"@type": "Person",
|
||||||
"name": "{{ . }}"
|
"name": "{{ . | safeJS }}"
|
||||||
},
|
},
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
"description": "{{ .Description }}"
|
"description": "{{ .Description | safeJS }}"
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|||||||
@@ -12,9 +12,9 @@
|
|||||||
"husky": "^4.2.3"
|
"husky": "^4.2.3"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npx babel src --out-file assets/js/theme.min.js --source-maps",
|
"build": "npx babel src --out-file assets/js/theme.min.js --source-maps && hugo -v --source=exampleSite --themesDir=../.. -D --gc",
|
||||||
"start": "npm run build && hugo server --source=exampleSite --themesDir=../.. --disableFastRender",
|
"start": "npm run build && hugo server --source=exampleSite --themesDir=../.. --disableFastRender",
|
||||||
"copy": "hugo -v --source=exampleSite --themesDir=../.. -D --gc --minify && rm -rf resources && cp -rf exampleSite/resources resources"
|
"copy": "rm -rf resources && cp -rf exampleSite/resources resources"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
|
|||||||
Reference in New Issue
Block a user