From 29a135b5607c269a01ac22b158cc7ac65cbd3112 Mon Sep 17 00:00:00 2001 From: Gregory Trolliet Date: Mon, 25 May 2020 11:22:03 +0200 Subject: [PATCH] [SHORTCODE] Add better handling of favicon --- CHANGELOG.md | 2 ++ layouts/partials/header.html | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b3bf94..494e382 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +* Possibility of set favicon param, must be svg, git or png ## [v1.0.0] - 2020-04-28 ### Added diff --git a/layouts/partials/header.html b/layouts/partials/header.html index ab274ea..021136b 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -21,8 +21,20 @@ {{ end }} - - + {{ if and (.Site.Params.favicon) (fileExists (print "static/images/" .Site.Params.favicon)) }} + {{ $name := .Site.Params.favicon }} + {{ $splitted := split $name "." }} + {{ $extension := index $splitted 1 }} + {{ if ( in "svg" $extension) }} + + {{ else if (in "gif png" $extension) }} + + {{ end}} + {{ else if (fileExists "static/images/favicon.svg") }} + + {{ else if (fileExists "static/images/favicon.png") }} + + {{ end }} {{ partial "opengraph.html" . }}