{%- capture fullUrl %}{{ site.url }}{{ page.url }}{% endcapture -%}
<!doctype html>
<html lang="en">
  <head>
    <title>
      {% if title %}
        {{ title }} •
      {% endif %}
      {{ site.title }}</title>
    <meta charset="utf-8">
    <meta name='viewport' content='width=device-width'>
    <link rel="canonical" href="{{ fullUrl }}" />
    <meta property="og:title" content="{% if title %}{{ title }} • {% endif %}{{site.title}}" />
    <meta name="description" content="{% if excerpt %}{{ excerpt}}{% else %}{{ site.description }}{% endif %}" />
    <meta property="og:description" content="{% if excerpt %}{{ excerpt}}{% else %}{{ site.description }}{% endif %}" />
    <meta property="og:type" content="article" />
    <meta property="og:url" content="{{ fullUrl }}" />
    <meta property="og:image" content="{{ image | getPostImage }}">
    <meta name="theme-color" content="#a855f7" />
    <meta name="generator" content="{{ eleventy.generator }}">
    <link
      rel="icon"
      type="image/x-icon"
      href="/assets/img/favicon/favicon-16x16.png">
    <link
      rel="icon"
      type="image/png"
      sizes="32x32"
      href="/assets/img/favicon/favicon-32x32.png">
    <link rel="apple-touch-icon" href="/assets/img/favicon/apple-touch-icon.png">
    <link href="/assets/styles/tailwind.css?v={% version %}" rel="stylesheet" />
    {% capture css %}
      {% include "../assets/styles/prism.css" %}
    {% endcapture %}
    <style>
      {{ css | cssmin }}
    </style>
    {% if env != 'development' %}
      <script>
        window.va = window.va || function() {
          (window.vaq = window.vaq || []).push(arguments);
        };
      </script>
      <script src="/_vercel/insights/script.js" defer></script>
    {% endif %}
    <link rel="webmention" href="https://webmention.io/coryd.dev/webmention" />
    <link rel="pingback" href="https://webmention.io/coryd.dev/xmlrpc" />
    <link
      type="application/atom+xml"
      rel="alternate"
      title="Cory Dransfeldt"
      href="/feed.xml">
    <link
      rel="alternate"
      type="application/json"
      title="Cory Dransfeldt"
      href="/feed.json" />
    <link
      rel="alternate"
      href="/follow.xml"
      title="Cory Dransfeldt's activity feed"
      type="application/rss+xml">
    <script>
      const isDarkMode = () => localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches);
      if (isDarkMode()) {
        document.documentElement.classList.add('dark')
      } else {
        document.documentElement.classList.remove('dark')
      }
    </script>
    <script type="application/ld+json">
      {% jsonLd meta, type, tags %}
    </script>
  </head>
  <body class="dark:text-white bg-white dark:bg-gray-900 font-sans text-gray-800">
    {{ content }}
    <script>
      document.getElementById("toggleDarkMode").addEventListener("click", function() {
        if (isDarkMode()) {
          localStorage.theme = 'light'
          document.documentElement.classList.remove('dark')
        } else {
          localStorage.theme = 'dark'
          document.documentElement.classList.add('dark')
        }
      });
      (function() {
        const pagination = document.getElementById('pagination');
        if (pagination) {
          pagination.addEventListener('change', (event) => {
            const page = parseInt(event.target.value)
            if (page === 1) {
              window.location.href = '/'
            } else {
              window.location.href = `/${
                event.target.value - 1
              }/`
            }
          })
        }
      })()
    </script>
  </body>
</html>
