Skip to content

Commit

Permalink
add dynamic content page path
Browse files Browse the repository at this point in the history
  • Loading branch information
JeelRajodiya committed May 12, 2024
1 parent 05c9a56 commit 2e51e7c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
21 changes: 21 additions & 0 deletions app/content/[...path]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { contentManager } from "@/lib/contentManager";
import React from "react";

export default function Content({ params }: { params: { path: string[] } }) {
const { Page } = contentManager.parseMdxFile(params.path.join("/") + ".mdx");
return <Page />;
}
export async function generateStaticParams() {
const outline = contentManager.outline;
const pathList: { path: string[] }[] = [];

outline.map((item) => {
item.steps.map((step) => {
pathList.push({
path: [item.folderName, step.fileName.replaceAll(".mdx", "")],
});
});
});
console.log(pathList);
return pathList;
}
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions lib/contentManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,6 @@ export default class ContentManager {
return contentOutline;
}
}

const contentManager = new ContentManager();
export { contentManager };

0 comments on commit 2e51e7c

Please sign in to comment.