1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-03 14:46:37 -04:00

clean up redirects/404s & other random housekeeping

This commit is contained in:
2020-06-02 14:00:40 -04:00
parent 23eabb48c0
commit a6cb95c0d7
15 changed files with 46 additions and 32 deletions

View File

@ -1,13 +1,20 @@
{{ $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" . }}
{{ $analytics := resources.Get "js/simple-analytics.js" | resources.ExecuteAsTemplate "js/simple-analytics.js" . }}
{{ $bundle := "" }}
{{ if eq hugo.Environment "development" }}
{{ $bundle = slice $darkmode $twemoji }}
{{ else }}
{{ $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 }}