refactor guide pages to use content collections
also configuration->guide
This commit is contained in:
parent
a449f976c7
commit
b066a48976
13 changed files with 68 additions and 83 deletions
30
src/pages/docs/guide/[...id].astro
Normal file
30
src/pages/docs/guide/[...id].astro
Normal file
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
import DocsLayout from "@layouts/DocsLayout.astro";
|
||||
import TOC from "@components/navigation/sidebars/TOC.astro";
|
||||
import TOCIntersectionObserver from "@src/components/hooks/TOCIntersectionObserver.astro";
|
||||
|
||||
import { getCollection, render } from "astro:content";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const guidePages = await getCollection("guide");
|
||||
|
||||
return guidePages.map(page => ({
|
||||
params: { id: page.id == "index" ? "/" : page.id },
|
||||
props: { page },
|
||||
}));
|
||||
}
|
||||
|
||||
const { page } = Astro.props;
|
||||
const { Content, headings } = await render(page);
|
||||
---
|
||||
<DocsLayout title={page.data.title} description="" headings={headings}>
|
||||
<div class="docs">
|
||||
<div class="docs-content">
|
||||
<hr>
|
||||
<Content/>
|
||||
</div>
|
||||
<TOC mobile={false} headings={headings} data-pagefind-ignore/>
|
||||
</div>
|
||||
</DocsLayout>
|
||||
|
||||
<TOCIntersectionObserver/>
|
Loading…
Add table
Add a link
Reference in a new issue