commit 473add39bd453365ad33bd4f28d9fcfd6786eca9
parent 18e9cc19ea9b5a5b19430e3c4c27e9868ded2daf
Author: Robert Lützner <robert.luetzner@pm.me>
Date: Wed, 22 Feb 2023 18:59:35 +0000
feat: load favicon if configured via params.favicon (#5)
This will display a favicon for the website. Favicons are cute little
icons that will show up on tabs in your browser, e.g. GitHub's mascot.
They can easily be generated by using online tools, e.g.
https://realfavicongenerator.net/
The resulting package only has to be downloaded and extracted into the
'static' directory of a Hugo website that is using this theme.
The path can then be set as follows in the config.yml:
```yaml
params:
favicon: favicon.ico
```
This fixes #3.
Co-authored-by: Robert Lützner <robert.luetzner@iternity.com>
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
@@ -3,7 +3,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- This ensures your site looks right on mobile devices -->
<link rel="stylesheet" type="text/css" href="/css/readable.css?v=1.0.1">
<meta name="description" content='{{ .Page.Description }}'>
+ {{ if .Site.Params.favicon }}
+ <link rel="shortcut icon" href="{{ relURL ($.Site.Params.favicon) }}" type="image/x-icon" /> <!-- Show a favicon for your site, if one is configured in the Params section of the config. -->
+ {{ end }}
{{ $title := print .Site.Title " | " .Title }}
{{ if .IsHome }}{{ $title = .Site.Title }}{{ end }}
<title>{{ $title }}</title>
-</head>
-\ No newline at end of file
+</head>