Skip to content

Commit fda4ecd

Browse files
authored
site map (#155)
1 parent 15d8729 commit fda4ecd

2 files changed

Lines changed: 7 additions & 37 deletions

File tree

.github/workflows/fastgpt-home-image.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ jobs:
6565
NEXT_PUBLIC_RYBBIT_TONGJI_SITEID=${{ secrets.NEXT_PUBLIC_RYBBIT_TONGJI_SITEID }}
6666
NEXT_PUBLIC_CUSTOM_PLAN_URL=${{ secrets.NEXT_PUBLIC_CUSTOM_PLAN_URL }}
6767
NEXT_PUBLIC_FAQ=true
68+
NEXT_PUBLIC_DEFAULT_LOCALE=zh
6869
- uses: actions-hub/kubectl@master
6970
env:
7071
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}

src/app/sitemap.ts

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,62 +9,31 @@ const locales = ['en', 'zh', 'ja']
99
export default function sitemap(): MetadataRoute.Sitemap {
1010
const baseUrl = process.env.NEXT_PUBLIC_HOME_URL || 'https://fastgpt.io'
1111
const basePaths = ['', '/enterprise', '/price']
12+
const now = new Date()
1213
const entries: MetadataRoute.Sitemap = []
1314

1415
// 根首页
15-
entries.push({
16-
url: baseUrl,
17-
lastModified: new Date(),
18-
changeFrequency: 'daily',
19-
priority: 1.0,
20-
alternates: {
21-
languages: Object.fromEntries(locales.map((l) => [l, `${baseUrl}/${l}`]))
22-
}
23-
})
16+
entries.push({ url: baseUrl, lastModified: now })
2417

2518
// 各语言的基础页面
2619
for (const locale of locales) {
2720
for (const path of basePaths) {
28-
entries.push({
29-
url: `${baseUrl}/${locale}${path}`,
30-
lastModified: new Date(),
31-
changeFrequency: 'weekly',
32-
priority: path === '' ? 1.0 : 0.8,
33-
alternates: {
34-
languages: Object.fromEntries(locales.map((l) => [l, `${baseUrl}/${l}${path}`]))
35-
}
36-
})
21+
entries.push({ url: `${baseUrl}/${locale}${path}`, lastModified: now })
3722
}
3823

3924
// FAQ 列表页
4025
if (showFAQ) {
41-
entries.push({
42-
url: `${baseUrl}/${locale}/faq`,
43-
lastModified: new Date(),
44-
changeFrequency: 'daily',
45-
priority: 0.9,
46-
alternates: {
47-
languages: Object.fromEntries(locales.map((l) => [l, `${baseUrl}/${l}/faq`]))
48-
}
49-
})
26+
entries.push({ url: `${baseUrl}/${locale}/faq`, lastModified: now })
5027
}
5128
}
5229

5330
// FAQ 详情页
5431
if (showFAQ) {
5532
for (const locale of locales) {
5633
for (const faqId of Object.keys(faq)) {
57-
const encodedFaqId = encodeURIComponent(faqId)
5834
entries.push({
59-
url: `${baseUrl}/${locale}/faq/${encodedFaqId}`,
60-
lastModified: new Date(),
61-
changeFrequency: 'weekly',
62-
priority: 0.7,
63-
alternates: {
64-
languages: Object.fromEntries(
65-
locales.map((l) => [l, `${baseUrl}/${l}/faq/${encodedFaqId}`])
66-
)
67-
}
35+
url: `${baseUrl}/${locale}/faq/${encodeURIComponent(faqId)}`,
36+
lastModified: now
6837
})
6938
}
7039
}

0 commit comments

Comments
 (0)