diff --git a/flake.lock b/flake.lock index 9a018f7..d5e38b6 100644 --- a/flake.lock +++ b/flake.lock @@ -149,11 +149,11 @@ "wiki": { "flake": false, "locked": { - "lastModified": 1716056148, - "narHash": "sha256-jWgjCkiExjBrRYcBzziNGPkorzJBLyWIa/ZUyUqqcr0=", + "lastModified": 1716579217, + "narHash": "sha256-Zu/DzCkjgic5qAFGgrRtpuPD8I9/kYqNxhCmixYL0GY=", "owner": "auxolotl", "repo": "wiki", - "rev": "644da0cf69dd962394c75cf4c924b19d56ba60c4", + "rev": "c2f9bdfeba0b44aae46569da6207867706e7f6ee", "type": "github" }, "original": { diff --git a/src/content/wiki b/src/content/wiki index 644da0c..c2f9bdf 160000 --- a/src/content/wiki +++ b/src/content/wiki @@ -1 +1 @@ -Subproject commit 644da0cf69dd962394c75cf4c924b19d56ba60c4 +Subproject commit c2f9bdfeba0b44aae46569da6207867706e7f6ee diff --git a/src/pages/[...slug].astro b/src/pages/[...slug].astro index e809fba..9dd5234 100644 --- a/src/pages/[...slug].astro +++ b/src/pages/[...slug].astro @@ -1,97 +1,83 @@ --- -import { type CollectionEntry, getCollection, getEntry } from 'astro:content'; -import NavBar from '../components/NavBar.astro'; -import Renderer from '../components/Renderer.astro'; -import NavPage from '../components/NavPage.astro'; -import "../style/globals.css" +import { type CollectionEntry, getCollection, getEntry } from "astro:content"; +import NavBar from "../components/NavBar.astro"; +import Renderer from "../components/Renderer.astro"; +import NavPage from "../components/NavPage.astro"; +import "../style/globals.css"; import { allPageAndDirectoryPaths } from "../lib/pagePaths"; -import { parse } from "node:path" +import { parse } from "node:path"; export async function getStaticPaths() { - const wikiPages = await getCollection('wiki'); - const paths = allPageAndDirectoryPaths(wikiPages); - return [ - { - params: { slug: undefined }, - props: { path: "home", name: "Home", post: await getEntry("wiki", "home") } - }, - ...Array.from(paths.entries()).flatMap(([key, post]) => { - if (!post) { - return [{ - params: { slug: key }, - props: { path: key, name: parse(key).name } - }] - } else { - return [ - { - params: { slug: post.slug }, - props: { path: post.id, name: post.data.title, post }, - }, - { - params: { slug: post.slug + ".md" }, - props: { path: post.id, name: post.data.title, post }, - } - ] - } - }) - - // ...pages.flatMap((post: CollectionEntry<'wiki'> | undefined) => { - // if (!post) { - // return [{ - // params: { slug: } - // }] - // } else { - // return [ - // { - // params: { slug: post.slug }, - // props: { path: post.id, name: post.data.title, post }, - // }, - // { - // params: { slug: post.slug + ".md" }, - // props: { path: post.id, name: post.data.title, post }, - // } - // ] - // } - // }) - ]; + const wikiPages = await getCollection("wiki"); + const paths = allPageAndDirectoryPaths(wikiPages); + return [ + { + params: { slug: undefined }, + props: { + path: "home", + name: "Home", + post: await getEntry("wiki", "home"), + }, + }, + ...Array.from(paths.entries()).flatMap(([key, post]) => { + if (!post) { + return [ + { + params: { slug: key }, + props: { path: key, name: parse(key).name }, + }, + ]; + } else { + return [ + { + params: { slug: post.slug }, + props: { path: post.id, name: post.data.title, post }, + }, + { + params: { slug: post.slug + ".md" }, + props: { path: post.id, name: post.data.title, post }, + }, + ]; + } + }), + ]; } type Props = { - post?: CollectionEntry<'wiki'> - path: string; - name: string; + post?: CollectionEntry<"wiki">; + path: string; + name: string; }; const { post, path, name } = Astro.props; --- - - Aux Docs - {name} + + Aux Docs - {name} + { + post ? ( + + ) : null + } - - { - post ? ( - - ) : ( - - ) - } - \ No newline at end of file + + {post ? : } +