hugo-theme-relearn/layouts/partials/custom-header.html
2025-02-19 21:00:50 +01:00

20 lines
No EOL
826 B
HTML

<!-- compat way of adding custom scripts in old Hugo documentation -->
{{- $assetBusting := partialCached "assetbusting.gotmpl" . }}
{{- $filePath := "css/custom.css" }}
{{- with (resources.Get (printf "/%s" $filePath)) }}
<link href="{{ .RelPermalink }}{{ $assetBusting }}" rel="stylesheet">
{{- else }}
{{- if (fileExists (printf "/static/%s" $filePath)) }}
<link href="{{ printf "%s" $filePath | relURL }}{{ $assetBusting }}" rel="stylesheet">
{{- end }}
{{- end }}
{{- $filePath := "js/custom.js" }}
{{- with (resources.Get (printf "/%s" $filePath)) }}
<script src="{{ .RelPermalink }}{{ $assetBusting }}" defer></script>
{{- else }}
{{- if (fileExists (printf "/static/%s" $filePath)) }}
<script src="{{ printf "%s" $filePath | relURL }}{{ $assetBusting }}" defer></script>
{{- end }}
{{- end }}