summaryrefslogtreecommitdiff
path: root/layouts/_partials/head/siteinfo.html
blob: 7f3c4476e017911ca2477a13b0eafc339399aae8 (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
<!-- Link preview meta tags -->
{{- $isHome := .IsHome -}}
{{- $title := cond $isHome .Site.Title .Title -}}
{{- $description := cond $isHome .Site.Params.description (default .Summary .Description | plainify) -}}
{{- $ogType := cond $isHome "website" "article" -}}
{{- $image := cond (isset .Params "banner")
    .Params.banner
    (cond (isset .Params "cover")
        .Params.cover
        .Site.Params.favicon)
-}}

<title>{{ $title }}</title>
<link rel="canonical" href="{{ .Permalink }}" />
<meta name="author" content="{{ .Site.Params.author.name }}" />
<link rel="icon" href="{{ .Site.Params.favicon }}">
<meta property="og:url" content="{{ .Permalink }}" />
<meta property="og:title" content="{{ $title }}" />
<meta property="og:type" content="{{ $ogType }}" />
<meta property="og:description" content="{{ $description }}" />
<meta name="description" content="{{ $description }}" />
<meta property="og:locale" content="{{ .Site.Language.Locale }}" />
<meta property="og:image" content="{{ $image }}" />

<!-- RSS -->
<link rel="alternate" type="application/atom+xml" href="{{.Site.BaseURL}}index.xml" title="{{ .Site.Title }}">
<link href="{{ .Site.Params.staticPrefix }}{{ "index.xml" | relURL }}" rel="alternate" type="application/rss+xml"
    title="{{ .Site.Title }}">

<!-- JSON-LD -->
<script type="application/ld+json">
    {
        "@context" : "http://schema.org",
        "@type" : "BlogPosting",
        "mainEntityOfPage": {
            "@type": "WebPage",
            "@id": "{{ .Site.BaseURL }}"
        },
        "articleSection" : "{{ .Section }}",
        "name" : "{{ .Title }}",
        "headline" : "{{ .Title }}",
        {{ if .IsHome -}}
        "description" : "{{ .Site.Params.description | plainify }}",
        {{- else -}}
        "description" : "{{ default .Summary .Description | plainify }}",
        {{- end }}
        "inLanguage" : "zh-CN",
        "author" : "{{ .Site.Params.author.name }}",
        "creator" : "{{ .Site.Params.author.name }}",
        "publisher": "{{ .Site.Params.author.name }}",
        "accountablePerson" : "{{ .Site.Params.author.name }}",
        "copyrightHolder" : "{{ .Site.Params.author.name }}",
        "copyrightYear" : "{{ .Date.Format "2006" }}",
        "datePublished": "{{ .Date }}",
        "dateModified" : "{{ .Date }}",
        "url" : "{{ .Permalink }}",
        "keywords" : [ {{ if isset .Params "tags" }}{{ range .Params.tags }}"{{ . }}",{{ end }}{{ end }} ]
    }
</script>