<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
  <head>
    {{ partial "meta/content-security-policy.html" . }}
    {{ .Hugo.Generator }}
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ block "title" . }}{{ .Title }} | {{ .Site.Title }}{{ end }}</title>
    <meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage }}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
    <meta name="keywords" content="{{ if .Keywords }}{{ delimit .Keywords ", " }}{{ else if and .IsPage .Params.tags }}{{ delimit .Params.tags ", " }}{{ else }}{{ range $term, $val := .Site.Taxonomies.categories }}{{ lower (humanize $term) }}, {{ end }}{{ end }}">
    {{ $default_noindex_kinds := slice "section" "taxonomy" "taxonomyTerm" }}
    {{ $noindex_kinds := .Site.Params.noindex_kinds | default $default_noindex_kinds }}
    {{ $is_noindex_true := and (isset .Params "noindex") .Params.noindex }}
    {{ if or (in $noindex_kinds .Kind) ($is_noindex_true) }}
      <meta name="robots" content="noindex">
    {{ end }}
    {{ template "_internal/opengraph.html" . }}
    {{ template "_internal/twitter_cards.html" . }}
    {{ partial "meta/ogimage-maybe.html" . }}
    {{ partial "meta/telegram-channel-maybe.html" . }}
    {{ if eq .Kind "home" }}
      {{ partial "meta/verifications.html" . }}
    {{ end }}
    {{ partial "meta/http-referrer.html" . }}
    {{ $import := resources.Get "/js/vendor/fetch-inject.min.js" }}
    {{ $baseof := resources.Get "/js/baseof.js" | resources.ExecuteAsTemplate "baseof.js" . }}
    <script integrity="{{ ($import | resources.Fingerprint "sha512").Data.Integrity }}">
      {{- $import.Content | safeJS -}}
    </script>
    <script integrity="{{ ($baseof | resources.Fingerprint "sha512").Data.Integrity }}">
      {{- $baseof.Content | safeJS -}}
    </script>
    {{ partial "head/modules.html" . }}
    {{ if .RSSLink }}
      <link href="{{ .RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}">
    {{ end }}
    <link rel="canonical" href="{{ .Permalink }}">
    {{ if (isset .Params "prev") }}
      <link rel="prev" href="{{ .Params.prev }}">
    {{ end }}
    {{ if (isset .Params "next") }}
      <link rel="next" href="{{ .Params.next }}">
    {{ end }}
    {{ partial "head/favicon.html" . }}
    {{ partial "global-styles.html" . }}
    {{ $highlights := findRE "class\\s*?=\\s*?\".*?\\bhighlight\\b.*?\"|class\\s*?=\\s*?highlight\\b" .Content }}
    {{ if ge (len $highlights) 1 }}
      <script integrity="sha512-ISTAV0GadOIz/NXXHOS+eCM0ysXVVHhQTlvA6LJxz/DeA5yIxm0Vqf5IE+WH0yuuXkayAKtoZkQ326nch5f/fg==">fetchInject([{{ "/css/syntax.css" | relURL }}]);</script>
      <noscript>
        <link href="{{ "/css/syntax.css" | relURL }}" rel="stylesheet">
      </noscript>
    {{ end }}
  </head>
  {{ $hackcss_disabled := .Site.Params.hackcss.disabled | default false }}
  {{ $hackcss_mode := .Site.Params.hackcss.mode | default "hack" }}
  {{ $hackcss_palette := .Site.Params.hackcss.palette | default "dark" }}
  <body class="{{ if ne $hackcss_disabled true }}{{ $hackcss_mode }} {{ $hackcss_palette }} main container{{ end }}">
    <header>{{ block "header" . }}{{ end }}</header>
    <main>{{ block "main" . }}{{ end }}</main>
    <footer>{{ block "footer" . }}{{ end }}</footer>
    {{ $defaults := .Site.Params.defaults.modules }}
    {{ $modules := .Site.Params.modules }}
    {{ if (or $modules $defaults) }}
      {{ with (default $defaults.toxic_swamp $modules.toxic_swamp) }}
        {{ partial "modules/toxic-swamp/toolbar.html" dict }}
      {{ end }}
    {{ end }}
  </body>
</html>
