From 84539d10ae89ce04863046ca7f59551bd2f71427 Mon Sep 17 00:00:00 2001 From: Simon C Date: Thu, 1 Jul 2021 15:29:20 +0200 Subject: [PATCH] feat: Add svg favicon --- layouts/_default/baseof.html | 2 +- layouts/partials/social_metadata.html | 8 ++++++++ scripts/run | 19 ++++++++++++++++--- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 105a056..027210c 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -4,7 +4,7 @@ {{ partial "header.html" . }} {{ partial "debug.html" . }} -
+
{{ block "main" . }}{{ end }}
{{ partial "footer.html" . }} diff --git a/layouts/partials/social_metadata.html b/layouts/partials/social_metadata.html index d77f3b2..9c9fb3b 100644 --- a/layouts/partials/social_metadata.html +++ b/layouts/partials/social_metadata.html @@ -1,5 +1,13 @@ {{/* https://github.com/msfjarvis/hugo-social-metadata */}} + {{ if .Site.Params.FaviconEmoji }} + + {{ else if .Site.Params.FaviconSVG }} + + {{ else if .Site.Params.FaviconFile }} + + {{ end }} + {{ if .Site.Params.TwitterCardType }} diff --git a/scripts/run b/scripts/run index 287b192..7880044 100755 --- a/scripts/run +++ b/scripts/run @@ -74,9 +74,22 @@ staging() { favicons() { echo - echo "🔍 Génération des favicons à partir d'une image 512px" + if [ -f "static/logo.png" ]; then + echo "🔍 Génération des favicons à partir d'une image 512px" + echo + convert static/logo.png -resize 48x48 -colors 16 \( -clone 0 -resize 16x16 -extent 16x16 \) \( -clone 0 -resize 32x32 -extent 32x32 \) \( -clone 0 -resize 48x48 -extent 48x48 \) -delete 0 static/favicon.ico + elif [ -f "static/logo.svg" ]; then + echo "🔍 Génération des favicons à partir d'une image SVG" + echo + convert static/logo.svg -resize 48x48 -colors 16 \( -clone 0 -resize 16x16 -extent 16x16 \) \( -clone 0 -resize 32x32 -extent 32x32 \) \( -clone 0 -resize 48x48 -extent 48x48 \) -delete 0 static/favicon.ico + else + echo "🚧 Il faut un fichier 'logo.svg' ou 'logo.png' dans le dossier static" + fi echo - convert static/logo.png -resize 32x32 -colors 16 \( -clone 0 -resize 16x16 -extent 16x16 \) \( -clone 0 -resize 32x32 -extent 32x32 \) -delete 0 static/favicon.ico + echo "Aide :" + echo "- liste des emoji : https://www.unicode.org/emoji/charts/full-emoji-list.html" + echo "- les emoji de twitter : https://github.com/twitter/twemoji" + echo "- Pour créer un base64 : \`echo \"data:image/svg+xml;base64,\$(cat static/logo.svg | base64 | tr -d '\r\n')\"\`" } optimizer() { @@ -127,7 +140,7 @@ help_generic() { echo "- ./run logs_backup 📥 Sauvegarde les logs" echo "- ./run logs_restore 📤 Restaure les logs" echo "- ./run stats 🌠 Mise à jour de GoAccess" - echo "- ./run favicons 🔍 Génération des favicons à partir d'une image 512px" + echo "- ./run favicons 🔍 Génération des favicons à partir d'une image 512px ou un SVG" echo "- ./run optimizer 🖼️ Optimisation des images" }