Files
mantelzorgwoning.info/layouts/partials/favicon.html
2025-12-12 10:05:48 +01:00

36 lines
1.6 KiB
HTML

{{- $faviconIco := site.Params.favicon -}}
{{- $faviconPng := site.Params.faviconPng -}}
{{- if or $faviconIco $faviconPng -}}
{{- /* ICO (shortcut / legacy) */ -}}
{{- if $faviconIco -}}
{{- if or (hasPrefix $faviconIco "http") (fileExists (add `static/` (string $faviconIco))) -}}
<link rel="shortcut icon" href="{{$faviconIco | absURL}}" type="image/x-icon">
<link rel="icon" href="{{$faviconIco | absURL}}" type="image/x-icon">
{{- else if fileExists (add `assets/` (string $faviconIco)) -}}
{{- $ico := resources.Get $faviconIco -}}
<link rel="shortcut icon" href="{{$ico.RelPermalink}}" type="image/x-icon">
<link rel="icon" href="{{$ico.RelPermalink}}" type="image/x-icon">
{{- end -}}
{{- end -}}
{{- /* PNG / Apple touch */ -}}
{{- if $faviconPng -}}
{{- if or (hasPrefix $faviconPng "http") (fileExists (add `static/` (string $faviconPng))) -}}
<link rel="icon" type="image/png" sizes="48x48" href="{{$faviconPng | absURL}}">
<link rel="icon" type="image/png" sizes="96x96" href="{{$faviconPng | absURL}}">
<link rel="apple-touch-icon" sizes="180x180" href="{{$faviconPng | absURL}}">
{{- else if fileExists (add `assets/` (string $faviconPng)) -}}
{{- $png := resources.Get $faviconPng -}}
{{- $png48 := $png.Resize "48x png" -}}
{{- $png96 := $png.Resize "96x png" -}}
{{- $png180 := $png.Resize "180x png" -}}
<link rel="icon" type="image/png" sizes="48x48" href="{{$png48.RelPermalink}}">
<link rel="icon" type="image/png" sizes="96x96" href="{{$png96.RelPermalink}}">
<link rel="apple-touch-icon" sizes="180x180" href="{{$png180.RelPermalink}}">
{{- end -}}
{{- end -}}
{{- end -}}