layouts/partials/header.html (view raw)
1<head>
2 <meta charset="utf-8" />
3 <meta http-equiv="X-UA-Compatible" content="IE=edge">
4 {{- $title := ( .Title ) -}}
5 {{- $siteTitle := ( .Site.Title ) -}}
6 {{- if .IsHome -}}
7 <title>{{ $siteTitle }} | Home </title>
8 {{- else -}}
9 <title>{{ $title }} - {{ $siteTitle }}</title>
10 {{- end -}}
11
12 {{- if isset .Site.Params "favicon" -}}
13 <link rel="icon" type="image/png" href={{ .Site.Params.favicon }} />
14 {{- end -}}
15
16 <meta name="viewport" content="width=device-width, initial-scale=1">
17 <meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
18 <meta property="og:image" content="{{ .Site.Params.og_image }}"/>
19 {{ with .OutputFormats.Get "rss" -}}
20 {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
21 {{ end -}}
22
23 {{- template "_internal/opengraph.html" . -}}
24 {{- template "_internal/twitter_cards.html" . -}}
25 {{ if and (isset .Site.Params "social") (.Site.Params.useCDN | default false) -}}
26 <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
27 {{- else if (isset .Site.Params "social") -}}
28 <script src="{{ .Site.BaseURL }}js/feather.min.js"></script>
29 {{ end }}
30 {{ if .Site.Params.useCDN | default false -}}
31 <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@1,500&display=swap" rel="stylesheet">
32 <link href="https://fonts.googleapis.com/css2?family=Fira+Sans&display=swap" rel="stylesheet">
33 <link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
34 {{- else -}}
35 {{ $fontstyle := resources.Get "css/fonts.css" | fingerprint }}
36 <link href="{{ $fontstyle.Permalink }}" rel="stylesheet">
37 {{ end }}
38 {{ $style := resources.Get "css/main.css" | fingerprint }}
39 <link rel="stylesheet" type="text/css" media="screen" href="{{ $style.Permalink }}" />
40 {{- if or (eq .Site.Params.mode "auto") (eq .Site.Params.mode "dark") -}}
41 {{ $darkstyle := resources.Get "css/dark.css" | fingerprint }}
42 <link rel="stylesheet" type="text/css" href="{{ $darkstyle.Permalink }}" {{ if eq .Site.Params.mode "auto" }}media="(prefers-color-scheme: dark)"{{ end }} />
43 {{ end }}
44 <!-- Custom CSS style get applied last -->
45 {{- if isset .Site.Params "customcss" }}
46 {{ range .Site.Params.customCSS }}
47 <link rel="stylesheet" type="text/css" href="{{ . | relURL }}">
48 {{ end }}
49 {{- end -}}
50 {{- range .Site.Params.customJS }}
51 {{- if or (hasPrefix . "http://") (hasPrefix . "https://") }}
52 <script src="{{ . }}"></script>
53 {{- else }}
54 <script src="{{ $.Site.BaseURL }}{{ . }}"></script>
55 {{- end }}
56 {{- end }}
57</head>