Skip to content

Commit f7d8d05

Browse files
authored
Merge pull request #119 from FinleyGe/fix/sitemap
fix: remove postbuild, build the sitemap during build stage
2 parents 0fbcbb6 + b0890a2 commit f7d8d05

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

next-sitemap.config.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/** @type {import('next-sitemap').IConfig} */
2-
32
module.exports = {
4-
siteUrl: process.env.NEXT_PUBLIC_HOME_URL || "https://fastgpt.io",
3+
siteUrl: process.env.NEXT_PUBLIC_HOME_URL || 'https://fastgpt.io',
54
generateRobotsTxt: true,
65
sitemapSize: 7000,
76

@@ -123,8 +122,6 @@ module.exports = {
123122
disallow: ['/api/', '/admin/']
124123
}
125124
],
126-
additionalSitemaps: [
127-
`${process.env.NEXT_PUBLIC_HOME_URL || "https://fastgpt.io"}/sitemap.xml`
128-
]
125+
additionalSitemaps: [`${process.env.NEXT_PUBLIC_HOME_URL || 'https://fastgpt.io'}/sitemap.xml`]
129126
}
130-
}
127+
};

next.config.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
/** @type {import('next').NextConfig} */
2-
32
const nextConfig = {
43
// Only use static export for production builds
54
// Dev mode uses dynamic server rendering for better DX
6-
...(process.env.NODE_ENV === 'production' && { output: "export" }),
5+
...(process.env.NODE_ENV === 'production' && { output: 'export' }),
76
images: { unoptimized: true }
8-
}
7+
};
98

10-
module.exports = nextConfig
9+
module.exports = nextConfig;

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
"scripts": {
66
"dev": "next dev",
77
"prebuild": "node scripts/manage-faq-routes.js",
8-
"postbuild": "next-sitemap",
9-
"build": "next build",
8+
"build": "next build && next-sitemap",
109
"start": "npx serve@latest out",
1110
"lint": "next lint",
1211
"prepare": "husky install",

0 commit comments

Comments
 (0)