next主题的hexo页面无法显示

hexo页面死活加载不出来.问题是苹果手机,苹果电脑上都正常,你windows???

首先排查到的问题是,在html文件的body标签里,又一个class="use-motion",然后整个页面就出不来了

试着在next配置里把motion关掉,果然页面就出来了.但这不是问题本质

排查问题

继续查看控制台日志,发现如下信息

https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js net::ERR_TIMED_OUT
https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css net::ERR_TIMED_OUT

Uncaught TypeError: Cannot read properties of undefined (reading 'timeline')
at motion.js:20:37
at Array.forEach (<anonymous>)
at Object.bootstrap (motion.js:19:16)
at Object.NexT.boot.motion (next-boot.js:66:8)
at HTMLDocument.<anonymous> (next-boot.js:74:13)

这是anime这个东西没下载下来,导致motioh代码没了.你为啥要去cdn.jsdelivr.net这个地方下载东西呢? 简直是天堂有路你不走,地狱无门你闯进来!!!!这里可是china!!!!

于是,继续排查,发现next主题又一个cdn配置项,third-part的东西都去cdn下载.anime恰巧就在third-part 同时,也发现,next的math也是依赖cdn的.这就同时解决了数学公式显示不正常的问题

修改wendors的cdn

把vendors里的plugins改成custom,使用npm.elemecdn.com代替cdn.jsdelivr.net/npm 或者直接把plugins改成unpkg,next会自动替换

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: custom
# 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: https://npm.elemecdn.com/${npm_name}@${version}/${npm_file}

如果还是下不下来,那就把plugins设置为local,然后把用到的plugins都下载都本地 具体做法参考https://github.com/next-theme/plugins