mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-01-17 22:28:32 +01:00
Refactor roadmap topic path
This commit is contained in:
parent
f4e505113c
commit
e8d2bd00c6
@ -1,16 +1,25 @@
|
|||||||
---
|
---
|
||||||
import Breadcrumbs from '../components/Breadcrumbs.astro';
|
import Breadcrumbs from '../../components/Breadcrumbs.astro';
|
||||||
import RoadmapBanner from '../components/RoadmapBanner.astro';
|
import RoadmapBanner from '../../components/RoadmapBanner.astro';
|
||||||
import BaseLayout from '../layouts/BaseLayout.astro';
|
import BaseLayout from '../../layouts/BaseLayout.astro';
|
||||||
import { getTopicFiles, TopicFileType } from '../lib/topic';
|
import { getTopicFiles, TopicFileType } from '../../lib/topic';
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
const topicPathMapping = await getTopicFiles();
|
const topicPathMapping = await getTopicFiles();
|
||||||
|
|
||||||
return Object.keys(topicPathMapping).map((topicSlug) => ({
|
return Object.keys(topicPathMapping).map((topicSlug) => {
|
||||||
params: { topicId: topicSlug.replace(/^\//, '') },
|
const topicDetails = topicPathMapping[topicSlug];
|
||||||
props: topicPathMapping[topicSlug],
|
const roadmapId = topicDetails.roadmapId;
|
||||||
}));
|
const topicId = topicSlug.replace(`/${roadmapId}/`, '');
|
||||||
|
|
||||||
|
return {
|
||||||
|
params: {
|
||||||
|
topicId,
|
||||||
|
roadmapId,
|
||||||
|
},
|
||||||
|
props: topicDetails,
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const { topicId } = Astro.params;
|
const { topicId } = Astro.params;
|
Loading…
x
Reference in New Issue
Block a user