We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5a465ea commit b2d8f89Copy full SHA for b2d8f89
README.md
@@ -123,7 +123,14 @@ In a few scenarios, you may want to deploy your blog on a CDN or other static se
123
npm run export
124
```
125
126
-After running the command, the generated static file will be in the `/out` directory.
+After running the command, the generated static file will be in the `/out` directory. If you want to set the prefix of the CDN,
127
+please set the environment variable:
128
+
129
+```bash
130
+# set CDN prefix
131
+export CDN_PREFIX=https://unix.bio
132
+npm run export
133
+```
134
135
<br />
136
README_CN.md
@@ -122,7 +122,13 @@ npx unix-bio migrate
122
-在运行命令后,静态文件会生成在 `/out` 文件夹。
+在运行导出命令后,静态文件会生成在 `/out` 文件夹。如果您想要自定义 CDN 的域名前缀,可以声明环境变量后再运行导出命令:
+# cdn prefix
如果你使用自定义的静态部署,将无法获得最好的性能,同时未来所有与服务端渲染、混合渲染相关的功能也不受支持。
此外,静态部署需要您自行解决各类路径与缓存问题。(请不要在 `issues` 中提此类问题)
next.config.js
@@ -1,3 +1,10 @@
1
+const isProd = process.env.NODE_ENV === 'production'
2
+const cdnPrefix = process.env.CDN_PREFIX || ''
3
4
+if (isProd && cdnPrefix) {
5
+ console.log(`> [unix.bio] You have customized the CDN prefix: ${cdnPrefix}.\n`)
6
+}
7
8
const withMDX = require('@next/mdx')({
9
extension: /\.(md|mdx)?$/,
10
options: {
@@ -12,6 +19,12 @@ const nextConfig = {
12
19
13
20
cssModules: true,
14
21
22
+ generateEtags: false,
23
24
+ poweredByHeader: false,
25
26
+ assetPrefix: isProd ? cdnPrefix : '',
27
15
28
cssLoaderOptions: {
16
29
importLoaders: 1,
17
30
localIdentName: '[local]___[hash:base64:5]',
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments