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