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

schema_page.html « partials « layouts - github.com/wangchucheng/hugo-eureka.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b231b0aa045f64aa90e11bca8e3f0ad6f10c4a48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<script type="application/ld+json">
{
    "@context": "https://schema.org",
    "@type": "Article",
    "mainEntityOfPage": {
        "@type": "WebPage",
        "@id": {{ .Permalink }}
    },
    "headline": "{{ partial "get_title" . }}",
    {{- $img := partial "get_image.html" (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 "get_image.html" (dict "context" . "url" .Site.Params.publisherLogo) -}}
        {{ $icon := partial "get_image.html" (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>