[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).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Added
|
||||||
|
* Possibility of set favicon param, must be svg, git or png
|
||||||
|
|
||||||
## [v1.0.0] - 2020-04-28
|
## [v1.0.0] - 2020-04-28
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -21,8 +21,20 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<link rel="stylesheet" href="/css/style.css">
|
<link rel="stylesheet" href="/css/style.css">
|
||||||
<link href="{{ .Site.RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}">
|
<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">
|
{{ if and (.Site.Params.favicon) (fileExists (print "static/images/" .Site.Params.favicon)) }}
|
||||||
<link rel="icon" type="image/gif" href="{{ .Site.BaseURL }}images/favicon_16x16.gif" sizes="16x16">
|
{{ $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" . }}
|
{{ partial "opengraph.html" . }}
|
||||||
|
|
Loading…
Reference in a new issue