feat: Add svg favicon

This commit is contained in:
Simon 2021-07-01 15:29:20 +02:00
parent 01aafb89a1
commit 84539d10ae
3 changed files with 25 additions and 4 deletions

View File

@ -4,7 +4,7 @@
<body>
{{ partial "header.html" . }}
{{ partial "debug.html" . }}
<main id="content">
<main>
{{ block "main" . }}{{ end }}
</main>
{{ partial "footer.html" . }}

View File

@ -1,5 +1,13 @@
{{/* https://github.com/msfjarvis/hugo-social-metadata */}}
{{ if .Site.Params.FaviconEmoji }}
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>{{ .Site.Params.FaviconEmoji }}</text></svg>">
{{ else if .Site.Params.FaviconSVG }}
<link rel="icon" href="data:image/svg+xml;{{ safeURL .Site.Params.FaviconSVG }}">
{{ else if .Site.Params.FaviconFile }}
<link rel="icon" href="{{ .Site.Params.FaviconFile }}">
{{ end }}
<!-- Configure meta and title tags -->
<meta property="og:type" content="website" />
{{ if .Site.Params.TwitterCardType }}

View File

@ -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"
}