From 7cfd23f61a001c860613ae8118634a14b849d5ab Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Thu, 9 Oct 2025 18:24:05 -0400 Subject: [PATCH] fix: latex --- src/content/config.ts | 2 ++ src/pages/[category]/[slug].astro | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/content/config.ts b/src/content/config.ts index 7f99dbe..50a0537 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -4,6 +4,8 @@ const base = z.object({ title: z.string(), description: z.string().optional(), date: z.string().optional(), + useKatex: z.boolean().optional(), + useD3: z.boolean().optional(), }); export const collections = { diff --git a/src/pages/[category]/[slug].astro b/src/pages/[category]/[slug].astro index 7a3a8de..d87c49a 100644 --- a/src/pages/[category]/[slug].astro +++ b/src/pages/[category]/[slug].astro @@ -1,17 +1,20 @@ --- import { getCollection } from "astro:content"; import PostLayout from "../../layouts/PostLayout.astro"; +import * as collections from "../../content/config"; export async function getStaticPaths() { - const CATS = ["algorithms", "software", "meditations", "autonomous-racing"]; + const categories = Object.keys(collections.collections).filter( + (c) => c !== "git" && c !== "gists", + ); const entries = []; - for (const c of CATS) { - const docs = await getCollection(c); - for (const d of docs) { + for (const category of categories) { + const docs = await getCollection(category); + for (const doc of docs) { entries.push({ - params: { category: c, slug: d.slug }, - props: { post: d }, + params: { category, slug: doc.slug }, + props: { post: doc }, }); } } @@ -20,11 +23,12 @@ export async function getStaticPaths() { const { post } = Astro.props; const category = Astro.params.category; -const pageTitle = `${category}/${post.data.title ?? post.slug}`; const { Content } = await post.render(); +const data = post.data; +const pageTitle = `${category}/${data.title ?? post.slug}`; --- - + {pageTitle}