website

Personal website
git clone https://github.com/michaelneuper/website.git
README | Files | Log | Refs

website/src/layouts/Base.astro (2784B)


---
// The Emacs frame every page shares: the head, the top line, the modeline and
// minibuffer, and *Help*. Pages fill the default slot with <main>,
// add to <head> through the "head" slot and list their own keys in "help".
import TopBar from "../components/frame/TopBar.astro";
import Modeline from "../components/frame/Modeline.astro";
import Help from "../components/frame/Help.astro";
import Analytics from "../components/frame/Analytics.astro";
import "../styles/fonts.css";
import "../styles/themes.css";
import "../styles/base.css";

interface Props {
  title?: string;
  description?: string;
  /** The home page links to its sections with #id; other pages need /#id. */
  home?: boolean;
  /** Modeline buffer name and major mode before any section scrolls into view. */
  buf: string;
  mode: string;
  /** Where "Skip to content" goes. */
  skip: string;
}

const {
  title = "Michael Neuper",
  description = "Computer science student at Stellenbosch University. Low-level software, electronics, a little security, and a lot of Emacs.",
  home = false,
  buf,
  mode,
  skip,
} = Astro.props;
---
<!doctype html>
<html lang="en" data-theme="gruvbox">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>{title}</title>
<meta name="description" content={description}>
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="alternate" type="application/rss+xml" title="Michael Neuper's posts" href="/index.xml">
<link rel="preload" href="/fonts/jetbrains-mono-regular.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/fonts/cm-regular.woff2" as="font" type="font/woff2" crossorigin>
{/* is:inline: Astro ships this script as written instead of bundling it, so it still runs before first paint. */}
<script is:inline>
  // Pick the theme before first paint so there is no flash. Keep this list in sync with src/scripts/themes.js.
  try {
    var t = localStorage.getItem("theme");
    // Themes saved before the doom- prefix was dropped (all but doom-one).
    if (t && t !== "doom-one") t = t.replace(/^doom-/, "");
    var known = /^(gruvbox|gruvbox-light|doom-one|atom-one-dark|modus-vivendi|modus-operandi|dracula|nord|catppuccin|tokyo-night|solarized-light)$/;
    if (!known.test(t || "")) t = matchMedia("(prefers-color-scheme: light)").matches ? "gruvbox-light" : "";
    if (t) document.documentElement.dataset.theme = t;
  } catch (e) {}
</script>
<Analytics />
<slot name="head" />
</head>
<!-- Reading the source? Good instinct. flag{view_source_is_recon} -->
<body>
<a class="skip" href={skip}>Skip to content</a>
<TopBar home={home} />
<slot />
<Modeline buf={buf} mode={mode} toTop={!home} />
<Help><slot name="help" /></Help>
</body>
</html>