diff --git a/README.md b/README.md index 9cdc513..f636927 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,19 @@ If you don't want to make any radical changes, it's the best option, because you ``` $ git submodule add https://github.com/rhazdon/hugo-theme-hello-friend-ng.git themes/hello-friend-ng ``` +### Favicon + +Use [RealFaviconGenerator](https://realfavicongenerator.net/) to generate these files, put them into your site's static folder: + +- android-chrome-192x192.png +- android-chrome-512x512.png +- apple-touch-icon.png +- favicon-16x16.png +- favicon-32x32.png +- favicon.ico +- mstile-150x150.png +- safari-pinned-tab.svg +- site.webmanifest ## How to configure diff --git a/assets/js/theme.js b/assets/js/theme.js index d5a324b..37a59de 100644 --- a/assets/js/theme.js +++ b/assets/js/theme.js @@ -3,6 +3,7 @@ const getTheme = window.localStorage && window.localStorage.getItem("theme"); const themeToggle = document.querySelector(".theme-toggle"); const isDark = getTheme === "dark"; +var metaThemeColor = document.querySelector("meta[name=theme-color]"); if (getTheme !== null) { document.body.classList.toggle("dark-theme", isDark); @@ -15,4 +16,7 @@ themeToggle.addEventListener("click", () => { "theme", document.body.classList.contains("dark-theme") ? "dark" : "light", ); + document.body.classList.contains("dark-theme") ? + metaThemeColor.setAttribute("content", "#252627") : metaThemeColor.setAttribute("content", "#fafafa"); + ; }); diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 14376ce..400774c 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -74,6 +74,7 @@ disableHugoGeneratorInject = false contentTypeName = "posts" # Default theme "light" or "dark" defaultTheme = "dark" + themeColor = "#252627" [params.logo] logoText = "$ cd /home/" diff --git a/layouts/partials/favicons.html b/layouts/partials/favicons.html index 431e523..d3366ba 100644 --- a/layouts/partials/favicons.html +++ b/layouts/partials/favicons.html @@ -2,5 +2,6 @@ - + + \ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 48b2ebd..f0d460e 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,33 +1,37 @@ - - - - - + + + + + {{ block "title" . }} - - {{ if .IsHome }} - {{ $.Site.Title }} {{ with $.Site.Params.Subtitle }} — {{ . }} {{ end }} - {{ else }} - {{ .Title }} :: {{ $.Site.Title }} {{ with $.Site.Params.Subtitle }} — {{ . }}{{ end }} - {{ end }} - + + {{ if .IsHome }} + {{ $.Site.Title }} {{ with $.Site.Params.Subtitle }} — {{ . }} {{ end }} + {{ else }} + {{ .Title }} :: {{ $.Site.Title }} {{ with $.Site.Params.Subtitle }} — {{ . }}{{ end }} + {{ end }} + {{ end }} - - + + {{ $style := resources.Get "scss/main.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }} {{ range $val := $.Site.Params.customCSS }} - {{ if gt (len $val) 0 }} - - {{ end }} +{{ if gt (len $val) 0 }} + +{{ end }} {{ end }} @@ -36,20 +40,23 @@ {{- template "_internal/schema.html" . }} {{- template "_internal/twitter_cards.html" . }} -{{ range .Params.categories }}{{ end }} -{{ if isset .Params "date" }}{{ end }} +{{ range .Params.categories }} +{{ end }} +{{ if isset .Params "date" }} +{{ end }} {{ if .RSSLink }} - + {{ end }} {{ if .OutputFormats.Get "json" }} - + {{ end }} {{- if templates.Exists "partials/extra-head.html" -}} - {{ partial "extra-head.html" . }} -{{- end }} +{{ partial "extra-head.html" . }} +{{- end }} \ No newline at end of file