From f196a94f3dd5f8d044254cec4357090f8fa188c0 Mon Sep 17 00:00:00 2001 From: Reijnn Date: Wed, 27 Feb 2019 12:46:39 +0100 Subject: [PATCH 1/4] Added theme-color param for mobile devices --- exampleSite/config.toml | 1 + layouts/partials/favicons.html | 1 + 2 files changed, 2 insertions(+) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 1ff142c..5008fcc 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -69,6 +69,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..b454691 100644 --- a/layouts/partials/favicons.html +++ b/layouts/partials/favicons.html @@ -4,3 +4,4 @@ + \ No newline at end of file From e35ede04c23ce69433132b779299f875ffe0478d Mon Sep 17 00:00:00 2001 From: Reijnn Date: Wed, 27 Feb 2019 12:54:16 +0100 Subject: [PATCH 2/4] Update README.md to generate favicons --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 From 22c42bbd5f9f8a2c44b7bcf878a099393e2e7dfc Mon Sep 17 00:00:00 2001 From: Reijnn Date: Tue, 5 Mar 2019 13:16:59 +0100 Subject: [PATCH 3/4] theme-color now changes with site theme --- assets/js/theme.js | 4 +++ layouts/partials/favicons.html | 4 +-- layouts/partials/head.html | 49 +++++++++++++++++++--------------- 3 files changed, 34 insertions(+), 23 deletions(-) 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/layouts/partials/favicons.html b/layouts/partials/favicons.html index b454691..d3366ba 100644 --- a/layouts/partials/favicons.html +++ b/layouts/partials/favicons.html @@ -2,6 +2,6 @@ - + - \ No newline at end of file + \ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html index bcab312..c7eae1f 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,31 +1,35 @@ - - - - - + + + + + {{ 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 .Site.Params.customCSS }} - + {{- end }} @@ -34,20 +38,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 From 2f53ecf8850a5f6a6d4c1377d0ef73d671df6835 Mon Sep 17 00:00:00 2001 From: Reijnn Date: Tue, 5 Mar 2019 13:26:06 +0100 Subject: [PATCH 4/4] Fix empty description meta tag --- layouts/partials/head.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index c0a4f06..f0d460e 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -4,7 +4,7 @@ + content="{{ if .IsHome }}{{ .Site.Params.homeSubtitle }}{{ else }}{{ .Summary | plainify }}{{ end }}" /> @@ -29,9 +29,9 @@ {{ range $val := $.Site.Params.customCSS }} - {{ if gt (len $val) 0 }} - - {{ end }} +{{ if gt (len $val) 0 }} + +{{ end }} {{ end }}