Skip to content

Commit 160df71

Browse files
authored
Merge pull request #46325 from sftim/20240511_favicon_hugo_pipes
Render favicons using Hugo Pipes
2 parents c7ff0e9 + 6357c3c commit 160df71

File tree

5 files changed

+38
-5
lines changed

5 files changed

+38
-5
lines changed
File renamed without changes.

assets/scss/_custom.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ body.td-404 main .error-details {
135135
height: 44px;
136136
background-repeat: no-repeat;
137137
background-size: contain;
138-
background-image: url("/images/favicon.png");
138+
background-image: url("/images/logo-header.png");
139139
}
140140

141141
#hamburger {

layouts/partials/favicons.html

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,36 @@
1-
<link rel="shortcut icon" type="image/png" href="{{ "images/favicon.png" | relURL }}">
2-
<link rel="apple-touch-icon" href="{{ "favicons/apple-touch-icon-180x180.png" | relURL }}" sizes="180x180">
3-
<link rel="manifest" href="/manifest.webmanifest">
4-
<link rel="apple-touch-icon" href="/images/kubernetes-192x192.png">
1+
<!-- site icons -->
2+
3+
{{- $logo_raster := resources.Get "images/kubernetes.png" -}}
4+
<link rel="shortcut icon" type="image/png" href="{{ $logo_raster.RelPermalink }}" />
5+
6+
{{- $sizes := slice 64 32 16 -}}
7+
{{- range $sizes -}}
8+
{{- $size := . }}
9+
{{- $favicon := $logo_raster.Fit (printf "%dx%d png" $size $size ) }}
10+
{{- with resources.Copy ( printf "icons/favicon-%d.png" $size ) $favicon -}}
11+
{{- $placed_icon := . -}}
12+
<link rel="icon" type="image/png" sizes="{{ printf "%dx%d" $size $size }}" href="{{ $placed_icon.RelPermalink }}" />
13+
{{- end -}}
14+
{{- end -}}
15+
16+
{{- $sizes := slice 256 196 192 180 167 160 152 120 76 -}}
17+
{{- range $sizes -}}
18+
{{- $size := . }}
19+
{{- $apple_icon := $logo_raster.Fit (printf "%dx%d png" $size $size ) }}
20+
{{- with resources.Copy (printf "icons/apple-touch-icon-%dx%d.png" $size $size ) $apple_icon -}}
21+
{{- $placed_icon := . -}}
22+
{{- if eq . 192 -}}
23+
<link rel="apple-touch-icon" href="{{ $placed_icon.RelPermalink }}" />
24+
{{- end -}}
25+
<link rel="{{ printf "apple-touch-icon-%dx%d" $size $size }}" href="{{ $placed_icon.RelPermalink }}" />
26+
{{- end -}}
27+
{{- end -}}
28+
29+
{{- $other_icon := $logo_raster.Fit "128x128 png" }}
30+
{{- with resources.Copy "icons/icon-128x128.png" $other_icon -}}
31+
{{- $placed_icon := . -}}
32+
<link rel="icon" type="image/png" href="{{ $placed_icon.RelPermalink }}" sizes=128x128>
33+
{{- end -}}
34+
35+
<meta name="theme-color" content="{{ index ($other_icon.Colors) 0 }}" />
36+

layouts/partials/hooks/head-end.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<link rel="manifest" href="/manifest.webmanifest">

static/images/logo-header.png

24 KB
Loading

0 commit comments

Comments
 (0)