fix ld+json date formats
This commit is contained in:
parent
b5388bf343
commit
0ed6d4f43f
|
@ -1,12 +1,13 @@
|
||||||
|
{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }}
|
||||||
{{ if .IsHome -}}
|
{{ if .IsHome -}}
|
||||||
<script type="application/ld+json">
|
<script type="application/ld+json">
|
||||||
{
|
{
|
||||||
"@context": "http://schema.org",
|
"@context": "http://schema.org",
|
||||||
"@type": "WebSite",
|
"@type": "WebSite",
|
||||||
"name": "{{ .Site.Title }}",
|
"name": "{{ .Site.Title }}",
|
||||||
"url": "{{ .Site.BaseURL }}",
|
"url": {{ .Site.BaseURL }},
|
||||||
"description": "{{ .Site.Params.description }}",
|
"description": "{{ .Site.Params.description }}",
|
||||||
"thumbnailUrl": "{{ .Site.Params.Logo | absURL }}",
|
"thumbnailUrl": {{ .Site.Params.Logo | absURL }},
|
||||||
"license": "{{ .Site.Params.Copyright }}"
|
"license": "{{ .Site.Params.Copyright }}"
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -18,12 +19,12 @@
|
||||||
"articleSection": "{{ .Section }}",
|
"articleSection": "{{ .Section }}",
|
||||||
"name": "{{ .Title | safeJS }}",
|
"name": "{{ .Title | safeJS }}",
|
||||||
"headline": "{{ .Title | safeJS }}",
|
"headline": "{{ .Title | safeJS }}",
|
||||||
"description": "{{ if .Description }}{{ .Description | safeJS }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}",
|
"description": {{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }},
|
||||||
"inLanguage": {{ .Site.LanguageCode | default "en-us" }},
|
"inLanguage": {{ .Site.LanguageCode | default "en-us" }},
|
||||||
"isFamilyFriendly": "true",
|
"isFamilyFriendly": "true",
|
||||||
"mainEntityOfPage": {
|
"mainEntityOfPage": {
|
||||||
"@type": "WebPage",
|
"@type": "WebPage",
|
||||||
"@id": "{{ .Permalink }}"
|
"@id": {{ .Permalink }}
|
||||||
},
|
},
|
||||||
"author" : {
|
"author" : {
|
||||||
"@type": "Person",
|
"@type": "Person",
|
||||||
|
@ -39,25 +40,24 @@
|
||||||
},
|
},
|
||||||
"copyrightHolder" : "{{ .Site.Title }}",
|
"copyrightHolder" : "{{ .Site.Title }}",
|
||||||
"copyrightYear" : "{{ .Date.Format "2006" }}",
|
"copyrightYear" : "{{ .Date.Format "2006" }}",
|
||||||
"dateCreated": "{{ .Date.Format "2006-01-02T15:04:05.00Z" | safeHTML }}",
|
"dateCreated": {{ .Date.Format $ISO8601 }},
|
||||||
"datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05.00Z" | safeHTML }}",
|
"datePublished": {{ .PublishDate.Format $ISO8601 }},
|
||||||
"dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05.00Z" | safeHTML }}",
|
"dateModified": {{ .Lastmod.Format $ISO8601 }},
|
||||||
"publisher":{
|
"publisher":{
|
||||||
"@type":"Organization",
|
"@type":"Organization",
|
||||||
"name": {{ .Site.Title }},
|
"name": {{ .Site.Title }},
|
||||||
"url": {{ .Site.BaseURL }},
|
"url": {{ .Site.BaseURL }},
|
||||||
"logo": {
|
"logo": {
|
||||||
"@type": "ImageObject",
|
"@type": "ImageObject",
|
||||||
"url": "{{ .Site.Params.logo | absURL }}",
|
"url": {{ .Site.Params.logo | absURL }},
|
||||||
"width":"32",
|
"width":"32",
|
||||||
"height":"32"
|
"height":"32"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"image": {{ if .Params.image }}{{ .Params.image | absURL }}{{ else}}{{ if .Params.featured_image }}{{ .Params.featured_image | absURL }}{{ else }}{{.Site.Params.logo | absURL }}{{ end }}{{ end }},
|
"image": {{ if .Params.image }}{{ .Params.image | absURL }}{{ else}}{{ if .Params.featured_image }}{{ .Params.featured_image | absURL }}{{ else }}{{.Site.Params.logo | absURL }}{{ end }}{{ end }},
|
||||||
"url" : "{{ .Permalink }}",
|
"url" : {{ .Permalink }},
|
||||||
"wordCount" : "{{ .WordCount }}",
|
"wordCount" : "{{ .WordCount }}",
|
||||||
"genre" : [ {{ range $index, $tag := .Params.tags }}{{ if $index }}, {{ end }}"{{ $tag }}" {{ end }}],
|
"keywords" : [ {{ range $index, $tag := .Params.tags }}{{ if $index }}, {{ end }}"{{ $tag }}" {{ end }}]
|
||||||
"articleBody": "{{ .Content | safeJS }}"
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
{{ end }}
|
{{ end }}
|
Loading…
Reference in New Issue