Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiple favicons support #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
<meta itemprop="name" content="{{ .Title }}" />
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
<meta name="theme-color" content="#f38e50">
<meta name="msapplication-TileColor" content="#f38e50">

{{ if fileExists "static/assets/favicon.png" -}}
<link href='{{ "assets/favicon.png" | relURL }}' rel="icon">
{{- end }}
{{ partial "favicons.html" . }}

{{- $style := resources.Get "sass/style.scss" | toCSS | minify | fingerprint }}
<link href='{{ $style.Permalink }}' rel='stylesheet' type="text/css" />
Expand Down
21 changes: 21 additions & 0 deletions layouts/partials/favicons.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if fileExists "static/assets/favicon.png" -}}
<link rel="icon" type="image/png" href='{{ "assets/favicon.png" | relURL }}'>
{{- end }}
{{- if fileExists "static/assets/favicon-16x16.png" }}
<link rel="icon" type="image/png" href='{{ "assets/favicon-16x16.png" | relURL }}' sizes="16x16">
{{- end }}
{{- if fileExists "static/assets/favicon-32x32.png" }}
<link rel="icon" type="image/png" href='{{ "assets/favicon-32x32.png" | relURL }}' sizes="32x32">
{{- end }}
{{- if fileExists "static/assets/favicon-48x48.png" }}
<link rel="icon" type="image/png" href='{{ "assets/favicon-48x48.png" | relURL }}' sizes="48x48">
{{- end }}
{{- if fileExists "static/assets/favicon-64x64.png" }}
<link rel="icon" type="image/png" href='{{ "assets/favicon-64x64.png" | relURL }}' sizes="64x64">
{{- end }}
{{- if fileExists "static/assets/favicon-96x96.png" }}
<link rel="icon" type="image/png" href='{{ "assets/favicon-96x96.png" | relURL }}' sizes="96x96">
{{- end }}
{{- if fileExists "static/assets/apple-touch-icon.png" }}
<link rel="apple-touch-icon" href='{{ "assets/apple-touch-icon.png" | relURL }}' sizes="180x180">
{{- end }}