<!doctype html>
<html
  lang="{{ site.Language.Locale | default "en-us" }}"
  data-display="{{ site.Params.displayMode | default "crt" }}"
  data-density="{{ site.Params.density | default "compact" }}"
>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  {{ $pageTitle := site.Title }}
  {{ if not .IsHome }}{{ $pageTitle = printf "%s · %s" .Title site.Title }}{{ end }}
  {{ $description := .Description | default site.Params.description }}
  {{ $socialImage := "og.jpg" | absURL }}

  <title>{{ $pageTitle }}</title>
  <meta name="description" content="{{ $description }}">
  <meta name="theme-color" content="#c8c8c8">
  <link rel="canonical" href="{{ .Permalink }}">
  <link rel="icon" type="image/png" href="{{ "favicon.png" | relURL }}">
  <link rel="alternate" type="application/rss+xml" title="{{ site.Title }}" href="{{ "index.xml" | absURL }}">

  <meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}">
  <meta property="og:site_name" content="{{ site.Title }}">
  <meta property="og:title" content="{{ $pageTitle }}">
  <meta property="og:description" content="{{ $description }}">
  <meta property="og:url" content="{{ .Permalink }}">
  <meta property="og:image" content="{{ $socialImage }}">
  <meta property="og:image:width" content="1200">
  <meta property="og:image:height" content="630">
  <meta property="og:image:alt" content="{{ site.Title }} — research notes and small software">
  {{ if .IsPage }}<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ end }}
  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:title" content="{{ $pageTitle }}">
  <meta name="twitter:description" content="{{ $description }}">
  <meta name="twitter:image" content="{{ $socialImage }}">
  <meta name="twitter:image:alt" content="{{ site.Title }} — research notes and small software">

  <link rel="preload" href="{{ "fonts/VT323-Regular.woff" | relURL }}" as="font" type="font/woff" crossorigin>
  {{ $styles := resources.Get "css/main.css" | minify | fingerprint "sha384" }}
  <link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}" crossorigin="anonymous">

  {{ if .Param "math" }}
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css">
    <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js"></script>
    <script
      defer
      src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js"
      onload="renderMathInElement(document.body, { delimiters: [{left: '$$', right: '$$', display: true}, {left: '$', right: '$', display: false}, {left: '\\(', right: '\\)', display: false}, {left: '\\[', right: '\\]', display: true}], throwOnError: false });"
    ></script>
  {{ end }}

  {{ $scripts := resources.Get "js/site.js" | minify | fingerprint "sha384" }}
  <script defer src="{{ $scripts.RelPermalink }}" integrity="{{ $scripts.Data.Integrity }}" crossorigin="anonymous"></script>
</head>

<body>
  <a class="skip-link" href="#main-content">Skip to content</a>
  {{ block "main" . }}{{ end }}

</body>
</html>
