{{/* Personal/custom script for light/dark mode and tabs */}}
{{ $js := slice
      (resources.Get "js/light_dark.js")
      (resources.Get "js/tabs.js") }}

{{/* Locally hosted code for KaTeX */}}
{{ $js = $js | append
      (resources.Get "js/lib/katex.js")
      (resources.Get "js/lib/auto-render.js") }}

{{/* Personal/custom scripts for KaTeX */}}
{{ $js = $js | append (resources.Get "js/katex.js") }}

{{/* Personal/custom scripts for table of contents */}}
{{ if not .Site.Params.hideToc }}
    {{ $js = $js | append (resources.Get "js/toc.js") }}
{{ end }}

{{/* Personal/custom scripts for codeblocks */}}
{{ $js = $js | append (resources.Get "js/codeblock.js") }}

{{ $js_bundle := $js | resources.Concat "js/bundle.js" | minify | fingerprint }}

<script defer language="javascript" type="text/javascript" src="{{ $js_bundle.RelPermalink }}"></script>


{{ if .Site.Params.plausible }}
<script defer data-domain="{{ .Site.Params.plausible_domain }}" src="{{ .Site.Params.plausible_script }}"></script>
{{ end }}

{{ if hugo.IsProduction -}}
  {{ template "_internal/google_analytics.html" . -}}
{{ end -}}
