Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CaiJimmy/hugo-theme-stack.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJimmy Cai <github@jimmycai.com>2022-06-12 13:50:04 +0300
committerGitHub <noreply@github.com>2022-06-12 13:50:04 +0300
commitba3dbc4163108d160a062ff20ced6374c48914c4 (patch)
tree9de68d73f6cc7b128ee92c43ac4f53bcd2841c1d
parent7d838dc7fd033fd97b27443b8a1ec64f173459e1 (diff)
feat: add favicon from assets folder
-rw-r--r--exampleSite/assets/img/favicon.pngbin0 -> 1031 bytes
-rw-r--r--exampleSite/assets/img/logo.jpgbin0 -> 21951 bytes
-rw-r--r--exampleSite/config/_default/params.toml3
-rw-r--r--layouts/partials/head/head.html7
4 files changed, 8 insertions, 2 deletions
diff --git a/exampleSite/assets/img/favicon.png b/exampleSite/assets/img/favicon.png
new file mode 100644
index 0000000..74e8efa
--- /dev/null
+++ b/exampleSite/assets/img/favicon.png
Binary files differ
diff --git a/exampleSite/assets/img/logo.jpg b/exampleSite/assets/img/logo.jpg
new file mode 100644
index 0000000..145804e
--- /dev/null
+++ b/exampleSite/assets/img/logo.jpg
Binary files differ
diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml
index b672b31..a87c986 100644
--- a/exampleSite/config/_default/params.toml
+++ b/exampleSite/config/_default/params.toml
@@ -1,6 +1,7 @@
mainSections = ["post"]
featuredImageField = "image"
rssFullContent = true
+favicon = "img/favicon.png"
[footer]
since = 2020
@@ -16,7 +17,7 @@ subtitle = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
[sidebar.avatar]
enabled = true
local = true
-src = "img/avatar.png"
+src = "img/logo.jpg"
[article]
math = false
diff --git a/layouts/partials/head/head.html b/layouts/partials/head/head.html
index 4d89b89..826ef3c 100644
--- a/layouts/partials/head/head.html
+++ b/layouts/partials/head/head.html
@@ -18,7 +18,12 @@
{{- end -}}
{{ with .Site.Params.favicon }}
- <link rel="shortcut icon" href="{{ . }}" />
+ {{ $favicon := resources.Get . }}
+ {{ if $favicon }}
+ <link rel="shortcut icon" href="{{ $favicon.RelPermalink }}" />
+ {{ else }}
+ {{ errorf "Failed loading favicon from %q" . }}
+ {{ end }}
{{ end }}
{{- template "_internal/google_analytics.html" . -}}