Add post: 暗黑能天使
This commit is contained in:
62
layouts/partials/components/schema-page.html
Normal file
62
layouts/partials/components/schema-page.html
Normal file
@@ -0,0 +1,62 @@
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "Article",
|
||||
"mainEntityOfPage": {
|
||||
"@type": "WebPage",
|
||||
"@id": {{ .Permalink }}
|
||||
},
|
||||
"headline": "{{ partial "get-title" . }}",
|
||||
{{- $img := partial "utils/get-image" (dict "context" . "url" .Params.featuredImage "keyword" "*featured*") }}
|
||||
{{- with $img }}
|
||||
"image": {{ . }},
|
||||
{{ end -}}
|
||||
|
||||
{{ if .IsPage -}}
|
||||
{{ if not .PublishDate.IsZero -}}
|
||||
"datePublished": {{ .PublishDate.Format "2006-01-02T15:04:05-07:00" }},
|
||||
{{ else if not .Date.IsZero -}}
|
||||
"datePublished": {{ .Date.Format "2006-01-02T15:04:05-07:00" }},
|
||||
{{ end -}}
|
||||
{{ if not .Lastmod.IsZero -}}
|
||||
"dateModified": {{ .Lastmod.Format "2006-01-02T15:04:05-07:00" }},
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ with .WordCount -}}
|
||||
"wordCount": {{ . }},
|
||||
{{ end -}}
|
||||
{{ with .Params.authors -}}
|
||||
"author": {
|
||||
"@type": "Person",
|
||||
"name": {{ . }}
|
||||
},
|
||||
{{ end -}}
|
||||
"publisher": {
|
||||
{{ with .Site.Params.siteType -}}
|
||||
"@type": {{ . }},
|
||||
{{ else -}}
|
||||
"@type": "Person",
|
||||
{{ end -}}
|
||||
{{ with .Site.Params.publisherName -}}
|
||||
"name": {{ . }},
|
||||
{{ else -}}
|
||||
"name": {{ .Site.Title }},
|
||||
{{ end -}}
|
||||
{{ $publisherLogo := partial "utils/get-image" (dict "context" . "url" .Site.Params.publisherLogo) -}}
|
||||
{{ $icon := partial "utils/get-image" (dict "context" . "url" .Site.Params.icon) -}}
|
||||
{{ if $publisherLogo -}}
|
||||
"logo": {
|
||||
"@type": "ImageObject",
|
||||
"url": {{ $publisherLogo }}
|
||||
}
|
||||
{{ else if $icon -}}
|
||||
"logo": {
|
||||
"@type": "ImageObject",
|
||||
"url": {{ $icon }}
|
||||
}
|
||||
{{ end -}}
|
||||
},
|
||||
"description": "{{ if .Description }}{{ .Description }}{{ else if .Summary }}{{ .Summary }}{{ else if .Site.Params.Description }}{{ .Site.Params.Description }}{{ end }}"
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user