diff --git a/src/components/SimplePageHeader.astro b/src/components/SimplePageHeader.astro
new file mode 100644
index 000000000..a54f920c0
--- /dev/null
+++ b/src/components/SimplePageHeader.astro
@@ -0,0 +1,26 @@
+---
+import YouTubeAlert from './YouTubeAlert.astro';
+
+export interface Props {
+ title: string;
+ description: string;
+ showYouTubeAlert?: boolean;
+}
+
+const { title, description, showYouTubeAlert = false } = Astro.props;
+---
+
+
+
+ {
+ showYouTubeAlert && (
+
+
+
+ )
+ }
+
+
{title}
+
{description}
+
+
diff --git a/src/lib/File.ts b/src/lib/File.ts
new file mode 100644
index 000000000..2b111a240
--- /dev/null
+++ b/src/lib/File.ts
@@ -0,0 +1,11 @@
+export interface MarkdownFileType> {
+ frontmatter: T;
+ file: string;
+ url: string;
+ Content: any;
+ getHeadings: () => {
+ depth: number;
+ slug: string;
+ text: string;
+ }[];
+}
\ No newline at end of file
diff --git a/src/lib/roadmap.ts b/src/lib/roadmap.ts
index 2b2d0600f..3648402e6 100644
--- a/src/lib/roadmap.ts
+++ b/src/lib/roadmap.ts
@@ -1,3 +1,7 @@
+import type { MarkdownFileType } from "./File";
+
+type RoadmapFileType = MarkdownFileType;
+
export interface RoadmapFrontmatter {
id: string;
jsonUrl: string;
@@ -25,6 +29,11 @@ export interface RoadmapFrontmatter {
tags: string[];
}
+/**
+ * Gets the IDs of all the roadmaps available on the website
+ *
+ * @returns string[] Array of roadmap IDs
+ */
export async function getRoadmapIds() {
const roadmapFiles = await import.meta.glob("/src/roadmaps/*/*.md", {
eager: true,
@@ -35,4 +44,24 @@ export async function getRoadmapIds() {
return fileName.replace(".md", "");
});
+}
+
+/**
+ * Gets the roadmap files which have the given tag assigned
+ *
+ * @param tag Tag assigned to roadmap
+ * @returns Promisified RoadmapFileType[]
+ */
+export async function getRoadmapsByTag(tag: string): Promise {
+ const roadmapFilesMap = await import.meta.glob(
+ '/src/roadmaps/*/*.md',
+ {
+ eager: true,
+ }
+ );
+
+ const roadmapFiles: MarkdownFileType[] = Object.values(roadmapFilesMap);
+ const filteredRoadmaps = roadmapFiles.filter(roadmapFile => roadmapFile.frontmatter.tags.includes(tag));
+
+ return filteredRoadmaps;
}
\ No newline at end of file
diff --git a/src/lib/topic.ts b/src/lib/topic.ts
index c716ab2eb..82848cf60 100644
--- a/src/lib/topic.ts
+++ b/src/lib/topic.ts
@@ -1,4 +1,4 @@
-import { joinPath } from './path';
+import type { MarkdownFileType } from './File';
import type { RoadmapFrontmatter } from './roadmap';
// Generates URL from the topic file path e.g.
@@ -64,24 +64,10 @@ export type BreadcrumbItem = {
url: string;
};
-type FileHeadingType = {
- depth: number;
- slug: string;
- text: string;
-};
-
-export interface TopicFileContentType {
- frontMatter: Record;
- file: string;
- url: string;
- Content: any;
- getHeadings: () => FileHeadingType[];
-}
-
export interface TopicFileType {
url: string;
text: string;
- file: TopicFileContentType;
+ file: MarkdownFileType;
roadmap: RoadmapFrontmatter;
roadmapId: string;
breadcrumbs: BreadcrumbItem[];
@@ -102,7 +88,7 @@ export async function getTopicFiles(): Promise> {
const mapping: Record = {};
for (let filePath of Object.keys(contentFiles)) {
- const fileContent: TopicFileContentType = contentFiles[filePath] as any;
+ const fileContent: MarkdownFileType = contentFiles[filePath] as any;
const fileHeadings = fileContent.getHeadings();
const firstHeading = fileHeadings[0];
diff --git a/src/pages/roadmaps.astro b/src/pages/roadmaps.astro
new file mode 100644
index 000000000..79c2553ad
--- /dev/null
+++ b/src/pages/roadmaps.astro
@@ -0,0 +1,25 @@
+---
+import SimplePageHeader from '../components/SimplePageHeader.astro';
+import BaseLayout from '../layouts/BaseLayout.astro';
+import { getRoadmapsByTag } from '../lib/roadmap';
+
+const roleRoadmaps = await getRoadmapsByTag('role-roadmap');
+const skillRoadmaps = await getRoadmapsByTag('skill-roadmap');
+---
+
+
+
+
+
+
+
+
{ roleRoadmaps.length }
+ { skillRoadmaps.length }
+
+
+
+