Browse Source

[SHORTCODE] Add better handling of favicon

master
Gregory Trolliet 1 year ago
parent
commit
29a135b560
  1. 2
      CHANGELOG.md
  2. 16
      layouts/partials/header.html

2
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

16
layouts/partials/header.html

@ -21,8 +21,20 @@
{{ end }}
<link rel="stylesheet" href="/css/style.css">
<link href="{{ .Site.RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}">
<link rel="icon" type="image/gif" href="{{ .Site.BaseURL }}images/favicon_32x32.gif" sizes="32x32">
<link rel="icon" type="image/gif" href="{{ .Site.BaseURL }}images/favicon_16x16.gif" sizes="16x16">
{{ 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) }}
<link rel="icon" type="image/svg+xml" href="{{ $.Site.BaseURL }}images/{{ $name }}" sizes="any">
{{ else if (in "gif png" $extension) }}
<link rel="icon" type="image/{{ $extension }}" href="{{ $.Site.BaseURL }}images/{{ $name }}">
{{ end}}
{{ else if (fileExists "static/images/favicon.svg") }}
<link rel="icon" type="image/svg+xml" href="{{ $.Site.BaseURL }}images/favicon.svg">
{{ else if (fileExists "static/images/favicon.png") }}
<link rel="icon" type="image/png" href="{{ $.Site.BaseURL }}images/favicon.png">
{{ end }}
{{ partial "opengraph.html" . }}

Loading…
Cancel
Save