Files
developer-roadmap/src/pages/pages.json.ts
T
Kamran AhmedandArik Chakma 51d986b86f Add support for CMD + K search (#3944)
* Add command k input

* On Enter open the page

* chore: backend fix

* Refactor pages and add retrieval

* Group separation, no result handling and filtering

* Fix responsiveness of command menu

* Activate on CMD+K and focus

* Add icons to menu

* Add page filtering

* Add search icon in navigation

---------

Co-authored-by: Arik Chakma <arikchangma@gmail.com>
2023-05-20 23:20:11 +01:00

37 lines
1.1 KiB
TypeScript

import { getAllBestPractices } from '../lib/best-pratice';
import { getAllGuides } from '../lib/guide';
import { getRoadmapsByTag } from '../lib/roadmap';
import { getAllVideos } from '../lib/video';
export async function get() {
const guides = await getAllGuides();
const videos = await getAllVideos();
const roadmaps = await getRoadmapsByTag('roadmap');
const bestPractices = await getAllBestPractices();
return {
body: JSON.stringify([
...roadmaps.map((roadmap) => ({
url: `/${roadmap.id}`,
title: roadmap.frontmatter.briefTitle,
group: 'Roadmaps',
})),
...bestPractices.map((bestPractice) => ({
url: `/best-practices/${bestPractice.id}`,
title: bestPractice.frontmatter.briefTitle,
group: 'Best Practices',
})),
...guides.map((guide) => ({
url: `/guides/${guide.id}`,
title: guide.frontmatter.title,
group: 'Guides',
})),
...videos.map((guide) => ({
url: `/videos/${guide.id}`,
title: guide.frontmatter.title,
group: 'Videos',
})),
]),
};
}