summaryrefslogtreecommitdiffstats
path: root/layouts/partials/head.html
blob: 8eb09f9ec1165388b7c2c43734d322849484ddab (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
<head prefix="og: http://ogp.me/ns#; dc: http://purl.org/dc/terms/#">
    {{- $resource_url := print .Site.BaseURL | safeURL -}}

    {{- $title := print .Title -}}
    {{ if .IsHome }}{{ $title = .Site.Title }}{{ end }}

    {{- $description := print .Params.Description -}}
    {{- if or .IsHome (eq .Params.Description "") (not .Params.Description) -}}
        {{ $description = .Site.Params.Description }}
    {{- end -}}

    {{- $author := print .Site.Author.name -}}
    {{- if .Params.author -}}{{ $author = .Params.author }}{{- end -}}

    <!-- Basic meta elements -->
    <meta charset="utf-8">

    <!-- Enable responsiveness on mobile devices -->
    <meta name="viewport" content="width=device-width,initial-scale=1.0,shrink-to-fit=no">

    <!-- Canonical link to help search engines -->
    <link rel="canonical" href="{{ .Permalink }}">

    <title>{{ $title }}</title>

    <!-- Dublin Core metadata for Zotero -->
    <meta property="dc:title" content="{{ $title }}">
    <meta property="dc:creator" content="{{ $author }}">
    <meta property="dc:identifier" content="{{ .Permalink }}">
    {{ if .Params.editor }}<meta property="dc:contributor" content="{{ .Params.editor }}">{{ end }}
    {{ if .Params.pub_date }}<meta property="dc:date" content="{{ .Params.pub_date }}">{{ end }}
    {{ if .Params.rights }}<meta property="dc:rights" content="{{ .Params.rights }}">{{ end }}
    <meta property="dc:source" content="{{ if .Params.source }}{{ .Params.source }}{{ else }}{{ .Site.Title }}{{ end }}">

    <!-- Open Graph metadata -->
    <meta property="og:title" content="{{ $title }}">
    <meta property="og:url" content="{{ .Permalink }}">
    <meta property="og:image" content="{{ $resource_url }}{{ "img/open-graph-logo.png" }}">
    <meta property="og:image:width" content="200">
    <meta property="og:image:height" content="200">
    {{- /* TODO: add fb:admins and fb:app_id */ -}}
    <!-- meta property="fb:admins" content="" -->
    <!-- meta property="fb:app_id" content="" -->

    {{- /* TODO: add ability to render 'article' type */ -}}
    <meta name="description" content="{{ $description }}">
    <meta property="og:description" content="{{ .Site.Params.Description }}">
    <meta property="og:type" content="website">

    <!-- CSS link -->
    {{ $sass := resources.Get "sass/style.scss" -}}
    {{ $style := $sass | resources.ToCSS | resources.Minify | resources.Fingerprint -}}
    <link rel="stylesheet" href="{{ $style.RelPermalink }}">

    <!-- Icons -->
    <link rel="apple-touch-icon-precomposed" sizes="180x180" href="{{ "apple-touch-icon-precomposed.png" | relURL }}">
    <link rel="shortcut icon" href="{{ "favicon.ico" | relURL }}">
</head>