3 Star 1 Fork 1

热门极速下载/developer-roadmap

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
sitemap.mjs 1.53 KB
一键复制 编辑 原始数据 按行查看 历史
Kamran Ahmed 提交于 2023-03-30 01:23 . Run prettier
import path from 'node:path';
import fs from 'node:fs/promises';
async function getRoadmapIds() {
return fs.readdir(path.join(process.cwd(), 'src/data/roadmaps'));
}
async function getBestPracticesIds() {
return fs.readdir(path.join(process.cwd(), 'src/data/best-practices'));
}
export function shouldIndexPage(pageUrl) {
return ![
'https://roadmap.sh/404',
'https://roadmap.sh/terms',
'https://roadmap.sh/privacy',
'https://roadmap.sh/pdfs',
'https://roadmap.sh/g',
].includes(pageUrl);
}
export async function serializeSitemap(item) {
const highPriorityPages = [
'https://roadmap.sh',
'https://roadmap.sh/about',
'https://roadmap.sh/roadmaps',
'https://roadmap.sh/best-practices',
'https://roadmap.sh/guides',
'https://roadmap.sh/videos',
...(await getRoadmapIds()).flatMap((id) => [
`https://roadmap.sh/${id}`,
`https://roadmap.sh/${id}/topics`,
]),
...(await getBestPracticesIds()).map(
(id) => `https://roadmap.sh/best-practices/${id}`
),
];
// Roadmaps and other high priority pages
for (let pageUrl of highPriorityPages) {
if (item.url === pageUrl) {
return {
...item,
// @ts-ignore
changefreq: 'monthly',
priority: 1,
};
}
}
// Guide and video pages
if (
item.url.startsWith('https://roadmap.sh/guides') ||
item.url.startsWith('https://roadmap.sh/videos')
) {
return {
...item,
// @ts-ignore
changefreq: 'monthly',
priority: 0.9,
};
}
return undefined;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_trending/developer-roadmap.git
[email protected]:mirrors_trending/developer-roadmap.git
mirrors_trending
developer-roadmap
developer-roadmap
master

搜索帮助