<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    {{ block "metaincludes" . }}
      {{ partial "redirect.html" .Params }}
    {{ end }}

    <title>{{ .Site.Title }}</title>

    {{ block "cssdependencyincludes" . }}
      <!-- Fork-awesome -->
      <link href="{{ "/fork-awesome/css/fork-awesome.min.css" | relURL }}" rel="stylesheet" type="text/css">
    {{ end }}

    {{ block "cssincludes" . }}
      {{ $options := dict "targetPath" "default.css" "outputStyle" "compressed" "enableSourceMap" false -}}
      {{ $style := resources.Get "/css/custom/nodes/default.scss" | resources.ToCSS $options | resources.Minify | resources.Fingerprint -}}
      <link rel="stylesheet" href="{{ $style.Permalink }}" />
    {{ end }}

    {{ $configData := dict "workerBaseURL" .Site.Params.workerBaseURL "scheduleURL" .Site.Params.scheduleURL "scheduleFetchInterval" .Site.Params.scheduleFetchInterval "twitterURL" .Site.Params.twitterURL "twitterFetchInterval" .Site.Params.twitterFetchInterval "mastodonURL" .Site.Params.mastodonURL "mastodonFetchInterval" .Site.Params.mastodonFetchInterval "musicURL" .Site.Params.musicURL "musicFetchInterval" .Site.Params.musicFetchInterval "cmsURL" .Site.Params.cmsURL "cmsFetchInterval" .Site.Params.cmsFetchInterval }}
    {{ $configjs := resources.Get "/js/custom/core/config.js" | js.Build (dict "params" $configData) | resources.Fingerprint }}
    <script src="{{ $configjs.Permalink }}" integrity="{{ $configjs.Data.Integrity }}"></script>

    {{ block "jsworkerincludes" . }}
      <!-- Just publish asset by calling .Permalink but without including it here. -->
      <!-- Web worker will be loaded by main JS later. -->
      {{ $fetchworkerjs := resources.Get "/js/custom/core/generic_fetch_worker.js" }}
      <!-- <script src="{{ $fetchworkerjs.Permalink }}" integrity="DO-NOT-USE-HERE"></script> -->
    {{ end }}
  </head>
  <body>
    {{ block "main" . }}
      <main id="main">
        <!-- Dynamic content inserted here -->
      </main>
    {{ end }}

    {{ block "jsdependencyincludes" . }}
      {{ $luxon := resources.Get "/js/luxon/luxon.min.js" | resources.Fingerprint }}
      <script src="{{ $luxon.Permalink }}" integrity="{{ $luxon.Data.Integrity }}"></script>

      {{ $preact := resources.Get "/js/preact/preact.min.js" | resources.Fingerprint }}
      <script src="{{ $preact.Permalink }}" integrity="{{ $preact.Data.Integrity }}"></script>

      {{ $htm := resources.Get "/js/htm/htm.js" | resources.Fingerprint }}
      <script src="{{ $htm.Permalink }}" integrity="{{ $htm.Data.Integrity }}"></script>
    {{ end }}

    {{ block "jsincludes" . }}
    {{ end }}
  </body>
</html>
