@@ -1,12 +1,7 @@
1import Link from "next/link";
1import Link from "next/link";
2import { useRouter } from "next/router";
2import { useRouter } from "next/router";
3import { join } from "path";
3import { join } from "path";
4−import {
4+import { getDocs, formatDate, buildPageTree, getPage } from "../../lib/lib";
9−} from "../../lib/lib";
10import Markdown from "../../components/Markdown";
5import Markdown from "../../components/Markdown";
12const breadcrumbs = (posts, paths) => {
7const breadcrumbs = (posts, paths) => {
@@ -85,23 +80,26 @@ function ContentArea(props) {
88−export default function DocsLayout({ posts, data, content }) {
83+export default function DocsLayout({ posts, data, content, params }) {
90 <div className="flex w-screen h-screen min-h-screen w-screen overflow-hidden">
85 <div className="flex w-screen h-screen min-h-screen w-screen overflow-hidden">
91 <Sidebar>{childPages("/docs", posts.children)}</Sidebar>
86 <Sidebar>{childPages("/docs", posts.children)}</Sidebar>
92− <ContentArea breadcrumbs={breadcrumbs(posts, [])} title={data.title}>
88+ breadcrumbs={breadcrumbs(posts, params.slug.slice(0, -1))}
93 <Markdown post={{ content: content }} />
91 <Markdown post={{ content: content }} />
94 </ContentArea>
92 </ContentArea>
99−export async function getStaticProps() {
97+export async function getStaticProps({ params }) {
100 const posts = buildPageTree(join(process.cwd(), "content/docs"));
98 const posts = buildPageTree(join(process.cwd(), "content/docs"));
101− const { data, content } = getIndexPage(
99+ const { data, content } = getPage(
102− join(process.cwd(), "content/docs", "_index.md")
100+ join(process.cwd(), "content/docs", params.slug.join("/"))
104− return { props: { posts, data, content } };
102+ return { props: { posts, data, content, params } };
107export async function getStaticPaths() {
105export async function getStaticPaths() {
@@ -118,7 +116,6 @@ export async function getStaticPaths() {
120 allHrefs("/docs", posts);
118 allHrefs("/docs", posts);
123 paths: slugs.filter((e) => e !== "/docs"),
120 paths: slugs.filter((e) => e !== "/docs"),
124 fallback: false,
121 fallback: false,