favicon: fix URL if site resides in subfolder #302

This commit is contained in:
Sören Weber 2022-07-06 00:26:05 +02:00
parent d1550bdddb
commit 691279743c
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589

View file

@ -1,14 +1,14 @@
{{- $assetBusting := not .Site.Params.disableAssetsBusting }} {{- $assetBusting := not .Site.Params.disableAssetsBusting }}
{{- if (fileExists "/static/images/favicon.svg") }} {{- if (fileExists "/static/images/favicon.svg") }}
<link rel="icon" href="{{ "/images/favicon.svg" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" type="image/svg+xml"> <link rel="icon" href="{{ "images/favicon.svg" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" type="image/svg+xml">
{{- else if (fileExists "/static/images/favicon.png") }} {{- else if (fileExists "/static/images/favicon.png") }}
<link rel="icon" href="{{ "/images/favicon.png" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" type="image/png"> <link rel="icon" href="{{ "images/favicon.png" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" type="image/png">
{{- else if (fileExists "/static/images/favicon.ico") }} {{- else if (fileExists "/static/images/favicon.ico") }}
<link rel="icon" href="{{ "/images/favicon.ico" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" type="image/x-icon"> <link rel="icon" href="{{ "images/favicon.ico" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" type="image/x-icon">
{{- else if (fileExists "/static/images/logo.svg") }} {{- else if (fileExists "/static/images/logo.svg") }}
<link rel="icon" href="{{ "/images/logo.svg" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" type="image/svg+xml"> <link rel="icon" href="{{ "images/logo.svg" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" type="image/svg+xml">
{{- else if (fileExists "/static/images/logo.png") }} {{- else if (fileExists "/static/images/logo.png") }}
<link rel="icon" href="{{ "/images/logo.png" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" type="image/png"> <link rel="icon" href="{{ "images/logo.png" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" type="image/png">
{{- else if (fileExists "/static/images/logo.ico") }} {{- else if (fileExists "/static/images/logo.ico") }}
<link rel="icon" href="{{ "/images/logo.ico" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" type="image/x-icon"> <link rel="icon" href="{{ "images/logo.ico" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" type="image/x-icon">
{{- end }} {{- end }}