Skip to content

Commit f534030

Browse files
committed
add
1 parent 4e5aed0 commit f534030

File tree

3 files changed

+52
-17
lines changed

3 files changed

+52
-17
lines changed

data/courses.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,34 @@ const sangamInstructor = {
2222
};
2323

2424
export const courses: Course[] = [
25+
{
26+
slug: 'quick-start-with-golang',
27+
title: 'Quick Start with Golang',
28+
description: 'Master Golang fundamentals in this hands-on course designed for beginners. Learn essential concepts like data types, control structures, functions, packages, and data structures through interactive labs and practical challenges.',
29+
level: 'Beginner',
30+
duration: '4 weeks',
31+
image: '/images/courses/quick-start-with-golang.png',
32+
price: 'Free',
33+
moduleCount: 8,
34+
...sangamInstructor,
35+
topics: [
36+
'Go installation and setup',
37+
'Variables, Constants, and Data Types',
38+
'Control Flow: Conditionals and Loops',
39+
'Functions and Methods',
40+
'Arrays, Slices, and Maps',
41+
'Structs and Interfaces',
42+
'Packages and Modules',
43+
'Error Handling',
44+
'Concurrency Basics',
45+
'Building a Simple CLI Application'
46+
],
47+
requirements: [
48+
'Basic programming knowledge in any language',
49+
'Familiarity with command line operations',
50+
'Computer with minimum 4GB RAM and 10GB free disk space'
51+
]
52+
},
2553
{
2654
slug: 'quick-start-with-golang-modules',
2755
title: 'Quick Start with Golang',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"@mdx-js/loader": "^3.0.0",
3535
"@mdx-js/mdx": "^3.1.0",
3636
"@mdx-js/react": "^3.1.0",
37-
"@next/mdx": "^14.2.0",
37+
"@next/mdx": "^15.3.2",
3838
"@swc/helpers": "^0.5.3",
3939
"@types/node": "^20.12.12",
4040
"@types/react": "^18.3.3",

pages/courses/[...slug].tsx

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -222,24 +222,31 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
222222

223223
export const getStaticPaths: GetStaticPaths = async () => {
224224
console.log('[getStaticPaths courses/[...slug]] Generating paths...');
225-
const paths = courses.map(course => ({
226-
params: { slug: [course.slug] }
227-
}));
228-
console.log('[getStaticPaths courses/[...slug]] Generated paths:', JSON.stringify(paths, null, 2));
229225

230-
// TODO: For a full static export of modules, you would also need to generate paths for each module.
231-
// Example:
232-
// const allPaths = [];
233-
// courses.forEach(course => {
234-
// allPaths.push({ params: { slug: [course.slug] } });
235-
// const modules = getModuleFiles(course.slug); // Assuming this can run at build time
236-
// modules.forEach(module => {
237-
// allPaths.push({ params: { slug: [course.slug, module.slug] } });
238-
// });
239-
// });
240-
226+
// Generate paths for all courses AND their modules
227+
const allPaths: { params: { slug: string[] } }[] = [];
228+
229+
// Add course overview paths
230+
courses.forEach(course => {
231+
allPaths.push({ params: { slug: [course.slug] } });
232+
233+
// Add module paths for each course
234+
try {
235+
const modules = getModuleFiles(course.slug);
236+
console.log(`[getStaticPaths] Found ${modules.length} modules for course: ${course.slug}`);
237+
238+
modules.forEach(module => {
239+
allPaths.push({ params: { slug: [course.slug, module.slug] } });
240+
});
241+
} catch (err) {
242+
console.error(`[getStaticPaths] Error getting modules for course ${course.slug}:`, err);
243+
}
244+
});
245+
246+
console.log('[getStaticPaths courses/[...slug]] Generated paths:', JSON.stringify(allPaths, null, 2));
247+
241248
return {
242-
paths: paths, // Or allPaths if you implement module path generation
249+
paths: allPaths,
243250
fallback: false
244251
};
245252
};

0 commit comments

Comments
 (0)