mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-07-22 00:15:59 -04:00
35 lines
1.1 KiB
HTML
35 lines
1.1 KiB
HTML
{{- define "__head_js" -}}
|
|
{{/* A super tiny script to restore dark mode off the bat (to hopefully avoid blinding flashes of white) */}}
|
|
{{ $themeScript := resources.Get "js/restore-theme.js" | js.Build (dict "target" "es2015" "format" "iife") }}
|
|
|
|
{{ with $themeScript }}
|
|
<script>
|
|
{{ .Content | safeJS }}
|
|
</script>
|
|
{{ end }}
|
|
{{- end -}}
|
|
|
|
{{- define "__body_js" -}}
|
|
{{/* Pull in JS processed by Webpack */}}
|
|
{{ with partial "functions/webpack" (dict "context" . "src" "main.js") }}
|
|
<script async defer src="{{ .src }}"></script>
|
|
{{ end }}
|
|
|
|
{{/* Detect shortcodes and append external scripts as needed once per page */}}
|
|
{{ if .HasShortcode "gh-buttons" -}}
|
|
{{ template "__shortcode_gh-buttons_js" $ }}
|
|
{{ end -}}
|
|
{{ if .HasShortcode "tweet" -}}
|
|
{{ template "__shortcode_twitter_js" $ }}
|
|
{{ end -}}
|
|
{{ if .HasShortcode "facebook" -}}
|
|
{{ template "__shortcode_facebook_js" $ }}
|
|
{{ end -}}
|
|
{{ if .HasShortcode "instagram" -}}
|
|
{{ template "__shortcode_instagram_js" $ }}
|
|
{{ end -}}
|
|
{{ if .HasShortcode "vimeo" -}}
|
|
{{ template "__shortcode_vimeo_js" $ }}
|
|
{{ end -}}
|
|
{{- end -}}
|