Skip to content

Commit dd5a096

Browse files
committed
feat: added favicon site configuration
1 parent a4c9a54 commit dd5a096

2 files changed

Lines changed: 54 additions & 1 deletion

File tree

config/_default/params.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,10 @@ geekdocFileTreeSortBy: "title"
9797
# Could be used if you want to define a default license for your content.
9898
# geekdocContentLicense:
9999
# name: CC BY-SA 4.0
100-
# link: https://creativecommons.org/licenses/by-sa/4.0/
100+
# link: https://creativecommons.org/licenses/by-sa/4.0/
101+
102+
# Favicon configuration
103+
faviconPath: "favicons/penn-engineering"
104+
safariPinnedTabColor: "#011F5B"
105+
msapplicationTileColor: "#011F5B"
106+
themeColor: "#011F5B"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{{/* Favicon configuration - easily switchable via params */}}
2+
{{ $faviconPath := .Site.Params.faviconPath | default "favicons/default" }}
3+
4+
{{/* Basic favicon */}}
5+
<link rel="shortcut icon" href="{{ printf "%s/favicon.ico" $faviconPath | absURL }}" type="image/x-icon">
6+
<link rel="icon" href="{{ printf "%s/favicon.ico" $faviconPath | absURL }}" type="image/x-icon">
7+
8+
{{/* PNG favicons if they exist */}}
9+
{{ if fileExists (printf "static/%s/favicon-32x32.png" $faviconPath) }}
10+
<link rel="icon" type="image/png" sizes="32x32" href="{{ printf "%s/favicon-32x32.png" $faviconPath | absURL }}">
11+
{{ end }}
12+
13+
{{ if fileExists (printf "static/%s/favicon-16x16.png" $faviconPath) }}
14+
<link rel="icon" type="image/png" sizes="16x16" href="{{ printf "%s/favicon-16x16.png" $faviconPath | absURL }}">
15+
{{ end }}
16+
17+
{{/* Apple Touch Icon */}}
18+
{{ if fileExists (printf "static/%s/apple-touch-icon.png" $faviconPath) }}
19+
<link rel="apple-touch-icon" sizes="180x180" href="{{ printf "%s/apple-touch-icon.png" $faviconPath | absURL }}">
20+
{{ end }}
21+
22+
{{/* Android Chrome Icons */}}
23+
{{ if fileExists (printf "static/%s/android-chrome-192x192.png" $faviconPath) }}
24+
<link rel="icon" type="image/png" sizes="192x192" href="{{ printf "%s/android-chrome-192x192.png" $faviconPath | absURL }}">
25+
{{ end }}
26+
27+
{{ if fileExists (printf "static/%s/android-chrome-512x512.png" $faviconPath) }}
28+
<link rel="icon" type="image/png" sizes="512x512" href="{{ printf "%s/android-chrome-512x512.png" $faviconPath | absURL }}">
29+
{{ end }}
30+
31+
{{/* Web Manifest */}}
32+
{{ if fileExists (printf "static/%s/site.webmanifest" $faviconPath) }}
33+
<link rel="manifest" href="{{ printf "%s/site.webmanifest" $faviconPath | absURL }}">
34+
{{ end }}
35+
36+
{{/* Safari Pinned Tab */}}
37+
{{ if fileExists (printf "static/%s/safari-pinned-tab.svg" $faviconPath) }}
38+
<link rel="mask-icon" href="{{ printf "%s/safari-pinned-tab.svg" $faviconPath | absURL }}" color="{{ .Site.Params.safariPinnedTabColor | default "#011F5B" }}">
39+
{{ end }}
40+
41+
{{/* Microsoft Tile */}}
42+
{{ if .Site.Params.msapplicationTileColor }}
43+
<meta name="msapplication-TileColor" content="{{ .Site.Params.msapplicationTileColor }}">
44+
{{ end }}
45+
46+
{{/* Theme Color */}}
47+
<meta name="theme-color" content="{{ .Site.Params.themeColor | default "#011F5B" }}">

0 commit comments

Comments
 (0)