aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/head-manifest.html
blob: 52be1f96f6c87b01b36825320d913c69287c5bd6 (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
{{- $author  := .Section -}}
{{- $home    := or ("" | absURL) "/" -}}
{{- $kind    := in (slice "home" "taxonomy" "term") .Page.Kind -}}
{{- $logo    := .Site.Params.webmanifest.logo -}}
{{- $profile := print "public/data/media/" $author "/" $author "-profile" -}}

{{- if not $kind -}}
  {{- $home = print ("" | absURL) "/" $author "/" -}}
  {{- if fileExists (print $profile ".gif")  -}} {{- $logo = (print $profile ".gif")  -}} {{- end -}}
  {{- if fileExists (print $profile ".webp") -}} {{- $logo = (print $profile ".webp") -}} {{- end -}}
  {{- if fileExists (print $profile ".png")  -}} {{- $logo = (print $profile ".png")  -}} {{- end -}}
{{- end -}}

{{- with $logo = resources.Get $logo -}}

{{- $16  := $logo.Fit "16x16" -}}
{{- $32  := $logo.Fit "32x32" -}}
{{- $180 := $logo.Fit "180x180" -}}
{{- $192 := $logo.Fit "192x192" -}}
{{- $512 := $logo.Fit "512x512" -}}

{{- if (eq $.Page.Kind "home") -}}
  {{- $writeToFile := ($32.Content | resources.FromString "/favicon.ico").Permalink -}}
{{- end -}}

<link rel="icon"             type="image/x-icon"         sizes="32x32"   href="data:image/ico;base64,{{ $32.Content | base64Encode }}" />
<link rel="icon"             type="{{ $16.MediaType }}"  sizes="16x16"   href="data:{{ $16.MediaType }};base64,{{ $16.Content | base64Encode }}" />
<link rel="icon"             type="{{ $32.MediaType }}"  sizes="32x32"   href="data:{{ $32.MediaType }};base64,{{ $32.Content | base64Encode }}" />
<link rel="apple-touch-icon" type="{{ $180.MediaType }}" sizes="180x180" href="data:{{ $180.MediaType }};base64,{{ $180.Content | base64Encode }}" />

<link rel="home" href="{{ $home }}" />

{{ "" -}} <!-- Newline -->

{{- with $manifest := $.Site.Params.webmanifest -}}
<link rel="manifest" href='data:application/manifest+json,{{ merge $manifest (dict
  "start_url" $home
  "icons"     (slice
                (dict
                  "sizes" "192x192"
                  "src"   (print "data:" $192.MediaType ";base64," ($192.Content | base64Encode))
                  "type"  (print $192.MediaType))
                (dict
                  "sizes" "512x512"
                  "src"   (print "data:" $512.MediaType ";base64," ($512.Content | base64Encode))
                  "type"  (print $512.MediaType))))
  | jsonify
  | urlquery
}}'>

<meta name="msapplication-TileColor"         content="#da532c" />
<meta name="msapplication-config"            content="none" />
<meta name="msapplication-square70x70logo"   content="none" />
<meta name="msapplication-square150x150logo" content="data:{{ $180.MediaType }};base64,{{ $180.Content | base64Encode }}" />
<meta name="msapplication-square310x310logo" content="none" />
<meta name="msapplication-wide310x150logo"   content="none" />
{{- end -}}
{{- end -}}