hexo-theme-redefine
hexo-theme-redefine copied to clipboard
[BUG] 在使用staticfile cdn后副标题无法显示
提交 Issue 前检查清单
- [X] 已经尝试执行
hexo clean,问题仍然存在 - [X] 已经更新到主题最新版本
- [X] 如果刚更新完主题出现此问题,已经确认同步了主题配置文件
Bug 描述
一直觉得少了什么东西,今天发现副标题没有显示。然后进行尝试 hexo clean 后问题仍然存在。
复现方法
我尝试新开了一个文件夹 hexo init。发现没有这个问题了。最后副标题设置如下:
subtitle:
text: ['hello world!', 'my name is gray!'] # subtitle text, array
hexo s 后发现还是能正常显示,怀疑是 cdn 的问题,然后启用 cdn,使用默认的 staticfile,发现副标题不显示了。经过测试,只有 staticfile 会有这个问题,另外浏览器控制台中还会有很多下载资源报错,简单查看怀疑是请求头错误。
预期结果
显示副标题。
截图
No response
电脑操作系统
Windows 11
浏览器
Firefox Developer Edition
版本
121.0b9 (64-bit)
移动端设备
No response
移动端操作系统
No response
浏览器
No response
版本
No response
其他
No response
另外在这个新开的hexo中我也出现了FontAwesome无法正常显示的问题,可能是下载字体的时候请求头出问题了?
Staticfile 目前本地 hexo s 使用 localhost:4000 预览时,会导致 CORS 无法加载资源文件,部署上博客后即可恢复正常。
Staticfile 目前本地
hexo s使用localhost:4000预览时,会导致 CORS 无法加载资源文件,部署上博客后即可恢复正常。
但是我最开始是部署上到 vercel 上后也没有,换成 bootcdn 就能显示了。
下面是部署后的情况:
上图是使用 bootcdn 的情况
然后配置文件改为 staticfile,运行 hexo clean & hexo g & hexo d
会发现副标题没有了,而且有字体未下载下来。
控制台报错:
使用 chrome 或者 microsoft edge 浏览器访问网站甚至会出现一部分 js 无法从 cdn 下载的情况。
并且发现控制台报错指向的网址都是其他使用了 staticfile cdn 的最新版本的 redefine 的博客。
类似于:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://cdn.staticfile.org/hexo-theme-redefine/2.6.0/fonts/noto-sans-sc-v26-chinese-simplified-700.woff2. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘https://mlou.xyz’).
ross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://cdn.staticfile.org/hexo-theme-redefine/2.6.0/webfonts/fa-solid-900.ttf. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘https://030706.xyz’).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://cdn.staticfile.org/hexo-theme-redefine/2.6.0/fonts/Chillax/Chillax-Variable.ttf. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘https://anzai.sleepingbed.top’).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://cdn.staticfile.org/hexo-theme-redefine/2.6.0/webfonts/fa-regular-400.ttf. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘https://030706.xyz’).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://cdn.staticfile.org/hexo-theme-redefine/2.6.0/webfonts/fa-solid-900.woff2. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘https://sunnydusk.cn’).
等报错。
目前换用 cdnjs 没有问题。
这个应该是 Staticfile 的问题吧,见此。
Statitic file 问题,请使用 CDNJS,等待修复
跟进:可以正常加载资源,但是编码似乎有点问题
This issue is stale because it has been open for 30 days with no activity.