1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-03 15:06:36 -04:00

add instant.page preloading script

This commit is contained in:
2020-10-29 16:07:03 -04:00
parent 3ee748a334
commit 26bb187c71
4 changed files with 28 additions and 18 deletions

View File

@ -1,14 +1,15 @@
{{/* only parse and append analytics script on production site */}}
{{- $includeAnalytics := eq hugo.Environment "production" -}}
{{- $includeProdScripts := eq hugo.Environment "production" -}}
{{- $darkmode := resources.Get "js/dark-mode.js" | resources.ExecuteAsTemplate "js/dark-mode.js" . -}}
{{- $twemoji := resources.Get "js/vendor/twemoji.js" | resources.ExecuteAsTemplate "js/vendor/twemoji.js" . -}}
{{- $bundle := slice $darkmode $twemoji -}}
{{- if $includeAnalytics }}
{{- if $includeProdScripts }}
{{- $instant := resources.Get "js/vendor/instantpage.js" -}}
{{- $analytics := resources.Get "js/analytics.js" | resources.ExecuteAsTemplate "js/analytics.js" . }}
{{- $bundle = slice $darkmode $twemoji $analytics }}
{{- $bundle = slice $darkmode $instant $twemoji $analytics }}
{{- end }}
{{- $js := $bundle | resources.Concat "/js/app.js" -}}