fix: latex
This commit is contained in:
parent
b024a8bbff
commit
7cfd23f61a
2 changed files with 14 additions and 8 deletions
|
|
@ -4,6 +4,8 @@ const base = z.object({
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
description: z.string().optional(),
|
description: z.string().optional(),
|
||||||
date: z.string().optional(),
|
date: z.string().optional(),
|
||||||
|
useKatex: z.boolean().optional(),
|
||||||
|
useD3: z.boolean().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const collections = {
|
export const collections = {
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,20 @@
|
||||||
---
|
---
|
||||||
import { getCollection } from "astro:content";
|
import { getCollection } from "astro:content";
|
||||||
import PostLayout from "../../layouts/PostLayout.astro";
|
import PostLayout from "../../layouts/PostLayout.astro";
|
||||||
|
import * as collections from "../../content/config";
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
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 = [];
|
const entries = [];
|
||||||
for (const c of CATS) {
|
for (const category of categories) {
|
||||||
const docs = await getCollection(c);
|
const docs = await getCollection(category);
|
||||||
for (const d of docs) {
|
for (const doc of docs) {
|
||||||
entries.push({
|
entries.push({
|
||||||
params: { category: c, slug: d.slug },
|
params: { category, slug: doc.slug },
|
||||||
props: { post: d },
|
props: { post: doc },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -20,11 +23,12 @@ export async function getStaticPaths() {
|
||||||
|
|
||||||
const { post } = Astro.props;
|
const { post } = Astro.props;
|
||||||
const category = Astro.params.category;
|
const category = Astro.params.category;
|
||||||
const pageTitle = `${category}/${post.data.title ?? post.slug}`;
|
|
||||||
const { Content } = await post.render();
|
const { Content } = await post.render();
|
||||||
|
const data = post.data;
|
||||||
|
const pageTitle = `${category}/${data.title ?? post.slug}`;
|
||||||
---
|
---
|
||||||
|
|
||||||
<PostLayout frontmatter={post.data} post={post}>
|
<PostLayout frontmatter={data} post={post}>
|
||||||
<Fragment slot="head">
|
<Fragment slot="head">
|
||||||
<title>{pageTitle}</title>
|
<title>{pageTitle}</title>
|
||||||
<script type="module" src="/scripts/index.js"></script>
|
<script type="module" src="/scripts/index.js"></script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue