Add pages JSON

pull/3941/head
Kamran Ahmed 1 year ago
parent 7a72c96e79
commit ad7ba44a2e
  1. 32
      src/pages/pages.json.astro

@ -0,0 +1,32 @@
---
import { getAllBestPractices } from '../lib/best-pratice';
import { getAllGuides } from '../lib/guide';
import { getRoadmapsByTag } from '../lib/roadmap';
import { getAllVideos } from '../lib/video';
const guides = await getAllGuides();
const videos = await getAllVideos();
const roadmaps = await getRoadmapsByTag('roadmap');
const bestPractices = await getAllBestPractices();
const formattedData = {
Roadmaps: roadmaps.map((roadmap) => ({
url: `/${roadmap.id}`,
title: roadmap.frontmatter.briefTitle,
})),
'Best Practices': bestPractices.map((bestPractice) => ({
url: `/${bestPractice.id}`,
title: bestPractice.frontmatter.briefTitle,
})),
Guides: guides.map((guide) => ({
url: `/${guide.id}`,
title: guide.frontmatter.title,
})),
Videos: videos.map((guide) => ({
url: `/${guide.id}`,
title: guide.frontmatter.title,
})),
};
---
{JSON.stringify(formattedData)}
Loading…
Cancel
Save