@@ -3,9 +3,7 @@ import Layout from '@layouts/Default.astro';
33import data from ' @data/projects.json' ;
44
55export async function getStaticPaths() {
6- // Extract all years (keys) from the data object
76 const years = Object .keys (data );
8- // Flatten all projects from all years into a single array
97 const allProjects = years .flatMap (year => data [year ]);
108
119 return allProjects .map (project => ({
@@ -16,6 +14,7 @@ export async function getStaticPaths() {
1614
1715const { project } = Astro .props ;
1816
17+ // Robust MDX loading
1918const allProjectMdxFiles = import .meta .glob (' /src/data/projects/*.mdx' , { eager: true });
2019const matchingPath = Object .keys (allProjectMdxFiles )
2120 .find (path => path .endsWith (` ${project .slug }.mdx ` ));
@@ -31,6 +30,17 @@ const { Content } = mdxModule;
3130<Layout title ={ ` Project: ${project .title } ` } >
3231 <section class =" section" >
3332 <div class =" container content" >
33+
34+ <!-- GitHub Button (Only shows if link exists) -->
35+ { project .githubLink && (
36+ <div class = " buttons mb-5" >
37+ <a href = { project .githubLink } target = " _blank" rel = " noopener noreferrer" class = " button is-dark" >
38+ <span class = " icon" ><i class = " fa-brands fa-github" ></i ></span >
39+ <span >View Source Code on GitHub</span >
40+ </a >
41+ </div >
42+ )}
43+
3444 <Content />
3545
3646 { project .leads && project .leads .length > 0 && (
0 commit comments