diff --git a/scripts/migrate-content.sh b/scripts/migrate-content.sh
new file mode 100644
index 000000000..20d602bdd
--- /dev/null
+++ b/scripts/migrate-content.sh
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+
diff --git a/src/components/MarkdownRoadmap/MarkdownRoadmap.astro b/src/components/MarkdownContent/MarkdownContent.astro
similarity index 100%
rename from src/components/MarkdownRoadmap/MarkdownRoadmap.astro
rename to src/components/MarkdownContent/MarkdownContent.astro
diff --git a/src/components/MarkdownRoadmap/Prism.css b/src/components/MarkdownContent/Prism.css
similarity index 100%
rename from src/components/MarkdownRoadmap/Prism.css
rename to src/components/MarkdownContent/Prism.css
diff --git a/src/components/TopicOverlay.astro b/src/components/TopicOverlay.astro
index 433745cef..8f966055b 100644
--- a/src/components/TopicOverlay.astro
+++ b/src/components/TopicOverlay.astro
@@ -24,7 +24,7 @@ import Loader from "./Loader.astro";
-
+
diff --git a/src/lib/roadmap.ts b/src/lib/roadmap.ts
index 75b340033..aa375b2b6 100644
--- a/src/lib/roadmap.ts
+++ b/src/lib/roadmap.ts
@@ -1,38 +1,71 @@
export interface RoadmapFrontmatter {
- id: string;
- jsonUrl: string;
- pdfUrl: string;
- order: number;
- featuredTitle: string;
- featuredDescription: string;
+ id: string;
+ jsonUrl: string;
+ pdfUrl: string;
+ order: number;
+ featuredTitle: string;
+ featuredDescription: string;
+ title: string;
+ description: string;
+ hasTopics: boolean;
+ dimensions: {
+ width: number;
+ height: number;
+ };
+ seo: {
title: string;
description: string;
- hasTopics: boolean;
- dimensions: {
- width: number;
- height: number;
- };
- seo: {
- title: string;
- description: string;
- keywords: string[];
- };
- relatedRoadmaps: string[];
- sitemap: {
- priority: number;
- changefreq: string;
- };
- tags: string[];
-};
+ keywords: string[];
+ };
+ relatedRoadmaps: string[];
+ sitemap: {
+ priority: number;
+ changefreq: string;
+ };
+ tags: string[];
+}
export async function getRoadmapIds() {
- const roadmapFiles = await import.meta.glob('/src/roadmaps/*/*.md', {
- eager: true,
- });
+ const roadmapFiles = await import.meta.glob("/src/roadmaps/*/*.md", {
+ eager: true,
+ });
+
+ return Object.keys(roadmapFiles).map((filePath) => {
+ const fileName = filePath.split("/").pop() || "";
+
+ return fileName.replace(".md", "");
+ });
+}
+
+export interface TopicFileType {
+ frontMatter: Record;
+ file: string;
+ url: string;
+ Content: any;
+};
+
+export async function getTopicPathMapping() {
+ const contentFiles = await import.meta.glob(
+ "/src/roadmaps/*/content/**/*.md", {
+ eager: true
+ }
+);
+
+ const mapping: Record = {};
+
+ Object.keys(contentFiles).forEach((filePath) => {
+ // => Sample Paths
+ // /src/roadmaps/vue/content/102-ecosystem/102-ssr/101-nuxt-js.md
+ // /src/roadmaps/vue/content/102-ecosystem/102-ssr/index.md
+ const url = filePath
+ .replace("/src/roadmaps/", "") // Remove the base `/src/roadmaps` from path
+ .replace("/content", "") // Remove the `/[roadmapName]/content`
+ .replace(/\/\d+-/g, "/") // Remove ordering info `/101-ecosystem`
+ .replace(/\/index\.md$/, "") // Make the `/index.md` to become the parent folder only
+ .replace(/\.md$/, ""); // Remove `.md` from the end of file
- return Object.keys(roadmapFiles).map(filePath => {
- const fileName = filePath.split('/').pop() || '';
+ mapping[url] = contentFiles[filePath] as any;
+ });
- return fileName.replace('.md', '');
- });
-}
\ No newline at end of file
+ return mapping;
+}
diff --git a/src/pages/[...topicId].astro b/src/pages/[...topicId].astro
new file mode 100644
index 000000000..10e80c19f
--- /dev/null
+++ b/src/pages/[...topicId].astro
@@ -0,0 +1,27 @@
+---
+import MarkdownContent from "../components/MarkdownContent/MarkdownContent.astro";
+import BaseLayout from "../layouts/BaseLayout.astro";
+import { getTopicPathMapping, TopicFileType } from "../lib/roadmap";
+
+export async function getStaticPaths() {
+ const topicPathMapping = await getTopicPathMapping();
+
+ console.log(topicPathMapping);
+
+ return Object.keys(topicPathMapping).map((topicSlug) => ({
+ params: { topicId: topicSlug },
+ props: topicPathMapping[topicSlug],
+ }));
+}
+
+const { topicId } = Astro.params;
+const props: TopicFileType = Astro.props as any;
+---
+
+
+
+
+
+
+
+
diff --git a/src/pages/[roadmapId].astro b/src/pages/[roadmapId].astro
index 1b02a4a08..37d92857c 100644
--- a/src/pages/[roadmapId].astro
+++ b/src/pages/[roadmapId].astro
@@ -1,6 +1,6 @@
---
import InteractiveRoadamp from "../components/InteractiveRoadmap/InteractiveRoadmap.astro";
-import MarkdownRoadmap from "../components/MarkdownRoadmap/MarkdownRoadmap.astro";
+import MarkdownContent from "../components/MarkdownContent/MarkdownContent.astro";
import RoadmapHeader from "../components/RoadmapHeader.astro";
import BaseLayout from "../layouts/BaseLayout.astro";
import { getRoadmapIds, RoadmapFrontmatter } from "../lib/roadmap";
@@ -41,7 +41,7 @@ const frontmatter = file.frontmatter as RoadmapFrontmatter;
)
}
-
+
-
+