This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
next-sitemap.config.js
85 lines (81 loc) · 2.23 KB
/
next-sitemap.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/** @type {import("next-sitemap").IConfig} */
const { locales } = require('./src/constants/language')
const site = process.env.SITE_URL || 'https://www.illacloud.com'
const getHrefLan = (href) => {
for (let i = 0; i < locales.length; i++) {
if (href.includes(locales[i]))
return locales[i].slice(0, 2).toLocaleLowerCase()
}
return 'en'
}
const transformUrl = async (list, config) => {
const res = []
await list.forEach(async (url) => {
res.push(await config.transform(config, url))
})
return res
}
module.exports = {
siteUrl: site,
generateRobotsTxt: true,
transform: async (config, path) => {
const currentPath = path.replace('/en-US', '')
return {
loc: currentPath, // => this will be exported as http(s)://<config.siteUrl>/<path>
changefreq: config.changefreq,
priority: config.priority,
lastmod: config.autoLastmod ? new Date().toISOString() : undefined,
alternateRefs: [
{
href: site + currentPath,
hreflang: getHrefLan(path),
hrefIsAbsolute: true,
},
],
}
},
additionalPaths: async (config) => {
const result = []
const list = [
'/integrations',
'/components',
'/integrations/MySQL',
'/integrations/PostgreSQL',
'/integrations/MariaDB',
'/integrations/TiDB',
'/integrations/Redis',
'/integrations/MongoDB',
'/integrations/Elastic%20Search',
'/integrations/Firebase',
'/integrations/Supabase%20DB',
'/integrations/Clickhouse',
'/integrations/Amazon%20DynamoDB',
'/integrations/Snowflake',
'/components/Upload',
'/components/Switch',
'/components/Select',
'/components/Radio%20group',
'/components/Checkbox%20Group',
'/components/Chart',
'/components/Tables',
'/components/PDF',
'/components/Video',
]
result.push(...(await transformUrl(list, config)))
return result
},
robotsTxtOptions: {
policies: [
{
userAgent: '*',
allow: '/',
disallow: [
'https://cloud.illacloud.com/*',
'https://builder.illacloud.com/*',
'https://status.illacloud.com/',
"'https://github.com/",
],
},
],
},
}