From 5e836ab7a59f6d1cdf17c50ddc468bedcb5f751a Mon Sep 17 00:00:00 2001
From: Kamran Ahmed <kamranahmed.se@gmail.com>
Date: Mon, 7 Apr 2025 16:11:25 +0100
Subject: [PATCH] Fix path

---
 src/pages/[roadmapId]/[...topicId].astro | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/pages/[roadmapId]/[...topicId].astro b/src/pages/[roadmapId]/[...topicId].astro
index 86b5b486e..fa2602ae3 100644
--- a/src/pages/[roadmapId]/[...topicId].astro
+++ b/src/pages/[roadmapId]/[...topicId].astro
@@ -3,6 +3,7 @@ import fs from 'node:fs';
 import path from 'node:path';
 import matter from 'gray-matter';
 import MarkdownIt from 'markdown-it-async';
+import { fileURLToPath } from 'node:url';
 
 export const prerender = false;
 
@@ -15,9 +16,14 @@ if (!topicId || !roadmapId) {
 // Handle nested paths by joining the segments
 const topicPath = Array.isArray(topicId) ? topicId.join('/') : topicId;
 
+// Get the project root directory
+const __filename = fileURLToPath(import.meta.url);
+const __dirname = path.dirname(__filename);
+const projectRoot = path.resolve(__dirname, '../../..');
+
 // Construct the path to the markdown file
 let contentPath = path.join(
-  process.cwd(),
+  projectRoot,
   'src',
   'data',
   'roadmaps',
@@ -31,7 +37,7 @@ console.log(contentPath);
 // Check if file exists
 if (!fs.existsSync(contentPath)) {
   const indexFilePath = path.join(
-    process.cwd(),
+    projectRoot,
     'src',
     'data',
     'roadmaps',
@@ -53,7 +59,7 @@ const { data: frontmatter, content } = matter(fileContent);
 
 // Get the roadmap metadata
 const roadmapPath = path.join(
-  process.cwd(),
+  projectRoot,
   'src',
   'data',
   'roadmaps',