Skip to content

Commit 20074eb

Browse files
authored
Merge pull request #1 from polygonart6777/add-favicon
Adds favicon
2 parents 9c13c11 + 28dea37 commit 20074eb

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Hugo
2+
/public/
3+
/resources/_gen/
4+
hinode.work.sum
5+
.hugo_build.lock
6+
.venv

layouts/partials/head/favicon.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{ $favicon := .Site.Params.favicon }}
2+
3+
{{ $logo := resources.Get $favicon.logo }}
4+
5+
{{ if $logo }}
6+
{{ range $size := $favicon.sizes }}
7+
{{ $dimensions := printf "%dx%d" $size $size }}
8+
{{ $icon := $logo.Fit $dimensions }}
9+
<link rel="icon" type="image/png" sizes="{{ $dimensions }}" href="{{ $icon.RelPermalink }}">
10+
{{ end }}
11+
{{ else }}
12+
{{/* Fallback if the logo image is not found */}}
13+
<link rel="icon" type="image/png" href="img/pyladiesvancouver-square-logo.png">
14+
{{ end }}

layouts/partials/head/head.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
{{ $desc := .Page.Description | default (.Page.Content | safeHTML | truncate 150) -}}
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
{{ partialCached "head/favicon.html" . -}}
7+
68
{{ hugo.Generator }}
79
<meta name="theme" content="{{ printf "Hinode %s" $version }}">
810
{{ partialCached "head/stylesheet-core.html" . -}}
@@ -31,7 +33,6 @@
3133
<link rel="preload" href="{{ $font }}" as="font" type="font/{{ strings.TrimPrefix "." (path.Ext $font) }}" crossorigin>
3234
{{- end -}}
3335
{{ partial "head/seo.html" . }}
34-
{{ partialCached "head/favicon.html" . -}}
3536
{{ if gt (len .Site.Languages) 1}}
3637
<meta name="lang" content="{{ .Site.Language }}">
3738
{{ end }}

0 commit comments

Comments
 (0)