fix ld+json date formats
This commit is contained in:
parent
eb8c80a39c
commit
b3635042a0
|
@ -40,22 +40,24 @@
|
|||
<!-- end og -->
|
||||
|
||||
<!-- structured data -->
|
||||
{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }}
|
||||
{{ $logo := "img/avatar-icon.png" }}
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context" : "http://schema.org",
|
||||
"@type" : "BlogPosting",
|
||||
"mainEntityOfPage": {
|
||||
"@type": "WebPage",
|
||||
"@id": "{{ .Site.BaseURL }}"
|
||||
"@id": {{ .Site.BaseURL }}
|
||||
},
|
||||
"articleSection" : "{{ .Section }}",
|
||||
"name" : "{{ .Title | safeJS }}",
|
||||
"name" : {{ .Title }},
|
||||
{{ if .Params.subtitle }}
|
||||
"headline" : "{{ .Params.subtitle | safeJS }}",
|
||||
"headline" : {{ .Params.subtitle }},
|
||||
{{ else }}
|
||||
"headline" : "{{ .Title | safeJS }}",
|
||||
"headline" : {{ .Title }},
|
||||
{{ end }}
|
||||
"description" : "{{ if .Description }}{{ .Description | safeJS }}{{ else }}{{if .IsPage}}{{ .Summary | safeJS }}{{ end }}{{ end }}",
|
||||
"description" : {{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }},
|
||||
{{ if isset .Params "language" }}
|
||||
"inLanguage" : "{{ .Params.language }}",
|
||||
{{ else if eq "essays" .Section }}
|
||||
|
@ -67,9 +69,10 @@
|
|||
{{ end }}
|
||||
"isFamilyFriendly": "true",
|
||||
{{ if .Params.bigimg }}
|
||||
"image": "{{.Site.BaseURL}}bigimg/{{ .Params.bigimg }}",
|
||||
{{- $image := printf "%s%s" "bigimg/" .Params.bigimg -}}
|
||||
"image": {{ $image | absURL }},
|
||||
{{ else }}
|
||||
"image": "{{.Site.BaseURL}}img/avatar-icon.png",
|
||||
"image": {{ $logo | absURL }},
|
||||
{{ end }}
|
||||
"author" : {
|
||||
"@type": "Person",
|
||||
|
@ -85,7 +88,7 @@
|
|||
"url": {{ .Site.BaseURL }},
|
||||
"logo": {
|
||||
"@type": "ImageObject",
|
||||
"url": "{{.Site.BaseURL}}img/avatar-icon.png",
|
||||
"url": {{ $logo | absURL }},
|
||||
"width":"32",
|
||||
"height":"32"
|
||||
}
|
||||
|
@ -93,14 +96,12 @@
|
|||
"accountablePerson" : "{{ .Site.Author.name }}",
|
||||
"copyrightHolder" : "{{ .Site.Title }}",
|
||||
"copyrightYear" : "{{ .Date.Format "2006" }}",
|
||||
"dateCreated": "{{ .Date.Format "2006-01-02T15:04:05.00Z" | safeHTML }}",
|
||||
"datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05.00Z" | safeHTML }}",
|
||||
"dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05.00Z" | safeHTML }}",
|
||||
"url" : "{{ .Permalink }}",
|
||||
"dateCreated": {{ .Date.Format $ISO8601 }},
|
||||
"datePublished": {{ .PublishDate.Format $ISO8601 }},
|
||||
"dateModified": {{ .Lastmod.Format $ISO8601 }},
|
||||
"url" : {{ .Permalink }},
|
||||
"wordCount" : "{{ .WordCount }}",
|
||||
"keywords" : [ {{ if isset .Params "tags" }}{{ range .Params.tags }}"{{ . }}",{{ end }}{{ end }}"{{ .Title }}", "{{ .Section }}" ],
|
||||
"genre" : [ {{ if isset .Params "tags" }}{{ range .Params.tags }}"{{ . }}",{{ end }}{{ end }}"{{ .Title }}", "{{ .Section }}" ],
|
||||
"articleBody": "{{ .Content | safeJS }}"
|
||||
"keywords" : [ {{ if isset .Params "tags" }}{{ range .Params.tags }}"{{ . }}",{{ end }}{{ end }}"{{ .Title }}", "{{ .Section }}" ]
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue