Skip to content

feat: sitemap #263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"prettier-plugin-sh": "^0.17.2",
"typescript-eslint": "^8.29.1",
"vite": "^6.2.6",
"vite-plugin-sitemap": "^0.7.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个应该不需要?Sitemap 是 VitePress 自带的吧?再看一看 VitePress 文档

"vitepress": "^1.6.3",
"vitest": "^3.1.1",
"zod": "^3.24.2"
Expand Down
19 changes: 19 additions & 0 deletions src/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,23 @@ export default {
],

vite,

sitemap: {
hostname: 'https://sustech-application.com',
exclude: [
'/content/type/[key].html',
'/content/year/[year].html',
'/content/region/[key].html',
'/content/department/[key].html'
],
transformItems: (items) => {
// 添加新项目或修改/筛选现有选项
items.push({
url: '/extra-page',
changefreq: 'monthly',
priority: 0.8
})
return items
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个肯定没用 Prettier 格式化,再看看 VSCode 的配置,应该是有保存时自动用 Prettier 格式化的哦

我还得再仔细看看这个 sitemap 是不是这样配

} as UserConfig;
Loading