chore: meta, books, blogroll, links

This commit is contained in:
Cory Dransfeldt 2024-11-17 08:09:32 -08:00
parent 8a3ece9530
commit 45b6e113b5
No known key found for this signature in database
10 changed files with 530 additions and 86 deletions

View file

@ -2,12 +2,22 @@
import "@styles/index.css";
import Header from "@components/Header.astro";
import Footer from "@components/Footer.astro";
import Metadata from "@components/Metadata.astro";
import { fetchNavigation } from "@utils/data/nav.js";
const currentUrl = Astro.url.pathname;
const nav = await fetchNavigation();
const { globals, pageTitle, description, ogImage, fullUrl, schema } =
Astro.props;
const {
globals,
schema = "page",
pageTitle,
description,
ogImage,
fullUrl,
...otherProps
} = Astro.props;
const isProduction = import.meta.env.MODE === "production";
---
@ -17,7 +27,7 @@ const isProduction = import.meta.env.MODE === "production";
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="color-scheme" content="light dark" />
<title>{globals.site_name}</title>
<title>{pageTitle || globals.site_name}</title>
<link
rel="preload"
href="/fonts/ml.woff2"
@ -32,25 +42,17 @@ const isProduction = import.meta.env.MODE === "production";
type="font/woff2"
crossorigin="anonymous"
/>
<meta
name="description"
content={description || globals?.site_description}
/>
<meta property="og:title" content={pageTitle || globals?.site_name} />
<meta
property="og:description"
content={description || globals?.site_description}
/>
<meta property="og:type" content={schema || "website"} />
<meta property="og:url" content={fullUrl} />
<meta property="og:image" content={`${ogImage}?class=w800`} />
<meta name="theme-color" content={globals?.theme_color} />
<meta name="fediverse:creator" content={globals?.mastodon} />
<link
rel="icon"
type="image/svg+xml"
href={`${globals?.cdn_url}${globals?.avatar_transparent}?class=w200`}
<Metadata
schema={schema}
globals={globals}
pageTitle={pageTitle}
description={description}
ogImage={ogImage}
fullUrl={fullUrl}
{...otherProps}
/>
<script defer src="/scripts/index.js"></script>
{
isProduction && (
@ -68,21 +70,6 @@ const isProduction = import.meta.env.MODE === "production";
</noscript>
</head>
<body>
<script>
(() => {
const currentTheme = sessionStorage.getItem("theme");
const metaColorScheme = document.querySelector(
'meta[name="color-scheme"]'
);
const prefersDarkScheme = window.matchMedia(
"(prefers-color-scheme: dark)"
).matches;
const themeToSet =
currentTheme || (prefersDarkScheme ? "dark" : "light");
if (!currentTheme) sessionStorage.setItem("theme", themeToSet);
metaColorScheme?.setAttribute("content", themeToSet);
})();
</script>
<div class="main-wrapper">
<main>
<Header nav={nav} siteName={globals?.site_name} url={currentUrl} />