| 1 | <!DOCTYPE html>
|
| 2 | <html lang="{{ .Site.Language.Lang }}">
|
| 3 | <head>
|
| 4 | <meta charset="utf-8">
|
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
| 6 | <meta name="description" content="{{ .Summary | default .Params.summary }}">
|
| 7 | <meta name="color-scheme" content="light dark">
|
| 8 |
|
| 9 | <title>{{ .Title }}</title>
|
| 10 |
|
| 11 | <script>
|
| 12 | (() => {
|
| 13 | try {
|
| 14 | const stored = localStorage.getItem('theme');
|
| 15 | const dark = stored
|
| 16 | ? stored === 'dark'
|
| 17 | : window.matchMedia('(prefers-color-scheme: dark)').matches;
|
| 18 | document.documentElement.dataset.theme = dark ? 'dark' : 'light';
|
| 19 | } catch (error) {
|
| 20 | document.documentElement.dataset.theme = 'light';
|
| 21 | }
|
| 22 | })();
|
| 23 | </script>
|
| 24 |
|
| 25 | {{ $style := resources.Get "main.scss" | css.Sass | resources.Minify | resources.Fingerprint }}
|
| 26 | <link rel="stylesheet" href="{{ $style.RelPermalink }}">
|
| 27 |
|
| 28 | {{ range .AlternativeOutputFormats -}}
|
| 29 | {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
| 30 | {{ end -}}
|
| 31 |
|
| 32 | {{ template "_internal/opengraph.html" . }}
|
| 33 | </head>
|
| 34 |
|
| 35 | <body>
|
| 36 | <header>
|
| 37 | <div class="logo">
|
| 38 | <a href="{{ .Site.BaseURL | relLangURL }}">
|
| 39 | <img class="logo-type" src="{{ (resources.Get "images/Cabotia.svg").RelPermalink }}" alt="A stylized cabotiá pumpkin, cabotiá logo">
|
| 40 | </a>
|
| 41 | </div>
|
| 42 |
|
| 43 | <nav>
|
| 44 | <a href="/">
|
| 45 | {{ i18n "nav.about" | safeHTML }}
|
| 46 | </a>
|
| 47 | <a href="/work">
|
| 48 | {{ i18n "nav.work" | safeHTML }}
|
| 49 | </a>
|
| 50 | <a href="/posts">
|
| 51 | {{ i18n "nav.blog" | safeHTML }}
|
| 52 | </a>
|
| 53 | <a href="mailto:contact@cabotia.dev">
|
| 54 | {{ i18n "nav.contact" | safeHTML }}
|
| 55 | </a>
|
| 56 | </nav>
|
| 57 |
|
| 58 | <button class="theme-toggle" type="button" aria-pressed="false" aria-label="Switch to dark theme">
|
| 59 | <svg class="icon-sun" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
| 60 | <circle cx="12" cy="12" r="4"></circle>
|
| 61 | <path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"></path>
|
| 62 | </svg>
|
| 63 | <svg class="icon-moon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
| 64 | <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
|
| 65 | </svg>
|
| 66 | </button>
|
| 67 | </header>
|
| 68 |
|
| 69 | <main>
|
| 70 | {{ block "main" . }}{{ end }}
|
| 71 | </main>
|
| 72 |
|
| 73 | <footer>
|
| 74 | <div>
|
| 75 | © {{ time.Now.Year }} · cabotiá
|
| 76 | </div>
|
| 77 |
|
| 78 | <div class="links">
|
| 79 | <a href="https://git.sr.ht/~porcellis/cabotia.dev">
|
| 80 | {{ i18n "footer.code" | safeHTML }}
|
| 81 | </a>,
|
| 82 |
|
| 83 | <a href="https://git.sr.ht/~porcellis/cabotia.dev/tree/main/item/LICENSE">
|
| 84 | {{ i18n "footer.license" | safeHTML }}
|
| 85 | </a>
|
| 86 | </div>
|
| 87 |
|
| 88 | <div class="fine-line">
|
| 89 | {{ i18n "footer.fine_line" | safeHTML }}
|
| 90 | </div>
|
| 91 | </footer>
|
| 92 |
|
| 93 | <script>
|
| 94 | (() => {
|
| 95 | const root = document.documentElement;
|
| 96 | const toggle = document.querySelector('.theme-toggle');
|
| 97 | if (!toggle) return;
|
| 98 |
|
| 99 | const sync = () => {
|
| 100 | const dark = root.dataset.theme === 'dark';
|
| 101 | toggle.setAttribute('aria-pressed', String(dark));
|
| 102 | toggle.setAttribute('aria-label', dark ? 'Switch to light theme' : 'Switch to dark theme');
|
| 103 | };
|
| 104 |
|
| 105 | toggle.addEventListener('click', () => {
|
| 106 | root.dataset.theme = root.dataset.theme === 'dark' ? 'light' : 'dark';
|
| 107 | try {
|
| 108 | localStorage.setItem('theme', root.dataset.theme);
|
| 109 | } catch (error) {}
|
| 110 | sync();
|
| 111 | });
|
| 112 |
|
| 113 | sync();
|
| 114 | })();
|
| 115 | </script>
|
| 116 | </body>
|
| 117 | </html>
|