1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-28 16:10:30 -04:00

21 lines
869 B
HTML

{{ $darkmode := resources.Get "js/dark-mode.js" | resources.ExecuteAsTemplate "js/dark-mode.js" . }}
{{ $twemoji := resources.Get "vendor/emoji/emoji.js" | resources.ExecuteAsTemplate "vendor/emoji/emoji.min.js" . }}
{{ $bundle := slice $darkmode $twemoji }}
{{/* only parse and append analytics script on production site */}}
{{ $useAnalytics := eq hugo.Environment "production" }}
{{ if $useAnalytics }}
{{ $analytics := resources.Get "js/simple-analytics.js" | resources.ExecuteAsTemplate "js/simple-analytics.js" . }}
{{ $bundle = slice $darkmode $twemoji $analytics }}
{{ end }}
{{ $js := $bundle | resources.Concat "/js/app.js" }}
<script async defer src="{{ $js.Permalink }}"></script>
{{/* proxy to simple analytics noscript on production */}}
{{ if $useAnalytics }}
<noscript><img src="{{ "sa/noscript.gif" | absURL }}" alt=""></noscript>
{{ end }}