[SHORTCODE] Add better handling of favicon
This commit is contained in:
parent
7756e1a2e0
commit
29a135b560
2 changed files with 16 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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…
Reference in a new issue