Jsdelivr 是一个很好用的 CDN 服务商,由一些不知名的原因,jsdelivr 在国内的备案被取消了,所以导致博客时不时抽风,这里记录以下 next 主题更换 cdn

NexT 在 8.9.0 版本增加了对于自定义 CDN 的选项,我们根据文档提示,我们需要在主题配置文件下的vendors.custom_cdn_url下添加 cdn 链接,如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
初始配置:
vendors:
# The CDN provider of NexT internal scripts.
# Available values: local | jsdelivr | unpkg | cdnjs | custom
# Warning: If you are using the latest master branch of NexT, please set `internal: local`
internal: local
# The default CDN provider of third-party plugins.
# Available values: local | jsdelivr | unpkg | cdnjs | custom
# Dependencies for `plugins: local`: https://github.com/next-theme/plugins
plugins: jsdelivr
# Custom CDN URL
# For example:
# custom_cdn_url: https://cdn.jsdelivr.net/npm/${npm_name}@${version}/${minified}
# custom_cdn_url: https://cdnjs.cloudflare.com/ajax/libs/${cdnjs_name}/${version}/${cdnjs_file}
custom_cdn_url:

我们只需要将下面代码替换初始配置代码即可

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
vendors:
# The CDN provider of NexT internal scripts.
# Available values: local | jsdelivr | unpkg | cdnjs | custom
# Warning: If you are using the latest master branch of NexT, please set `internal: local`
internal: local
# The default CDN provider of third-party plugins.
# Available values: local | jsdelivr | unpkg | cdnjs | custom
# Dependencies for `plugins: local`: https://github.com/next-theme/plugins
plugins: unpkg
# Custom CDN URL
# For example:
# custom_cdn_url: https://cdn.jsdelivr.net/npm/${npm_name}@${version}/${minified}
# custom_cdn_url: https://cdnjs.cloudflare.com/ajax/libs/${cdnjs_name}/${version}/${cdnjs_file}
fontawesome: https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-ms/font-awesome/5.15.2/css/all.min.css
animate_css: https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-ms/animate.css/3.1.1/animate.min.css
anime: https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-ms/animejs/3.2.1/anime.min.js
mediumzoom: https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/medium-zoom/1.0.6/medium-zoom.min.js
jquery: https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-ms/jquery/3.5.1/jquery.min.js
fancybox_js: https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-ms/fancybox/3.5.7/jquery.fancybox.min.js
fancybox_css: https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-ms/fancybox/3.5.7/jquery.fancybox.min.css
lazyload: https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-ms/lozad.js/1.16.0/lozad.min.js
pangu: https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-ms/pangu/4.0.7/pangu.min.js
quicklink: https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-ms/quicklink/2.1.0/quicklink.umd.min.js
gitalk_js: https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-ms/gitalk/1.7.0/gitalk.min.js
gitalk_css: https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-ms/gitalk/1.7.0/gitalk.min.css

这里只是我需要用到的 cdn 地址,如果同志们有需要其他文件 cdn 请按需自行添加即可

end