diff options
author | Jimmy Cai <github@jimmycai.com> | 2022-06-12 13:50:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-12 13:50:04 +0300 |
commit | ba3dbc4163108d160a062ff20ced6374c48914c4 (patch) | |
tree | 9de68d73f6cc7b128ee92c43ac4f53bcd2841c1d | |
parent | 7d838dc7fd033fd97b27443b8a1ec64f173459e1 (diff) |
feat: add favicon from assets folder
-rw-r--r-- | exampleSite/assets/img/favicon.png | bin | 0 -> 1031 bytes | |||
-rw-r--r-- | exampleSite/assets/img/logo.jpg | bin | 0 -> 21951 bytes | |||
-rw-r--r-- | exampleSite/config/_default/params.toml | 3 | ||||
-rw-r--r-- | layouts/partials/head/head.html | 7 |
4 files changed, 8 insertions, 2 deletions
diff --git a/exampleSite/assets/img/favicon.png b/exampleSite/assets/img/favicon.png Binary files differnew file mode 100644 index 0000000..74e8efa --- /dev/null +++ b/exampleSite/assets/img/favicon.png diff --git a/exampleSite/assets/img/logo.jpg b/exampleSite/assets/img/logo.jpg Binary files differnew file mode 100644 index 0000000..145804e --- /dev/null +++ b/exampleSite/assets/img/logo.jpg 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" . -}} |