Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wangchucheng/hugo-eureka.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/partials/components/schema-page.html')
-rw-r--r--layouts/partials/components/schema-page.html62
1 files changed, 62 insertions, 0 deletions
diff --git a/layouts/partials/components/schema-page.html b/layouts/partials/components/schema-page.html
new file mode 100644
index 0000000..4829647
--- /dev/null
+++ b/layouts/partials/components/schema-page.html
@@ -0,0 +1,62 @@
+<script type="application/ld+json">
+{
+ "@context": "https://components/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> \ No newline at end of file