hexo-theme-redefine icon indicating copy to clipboard operation
hexo-theme-redefine copied to clipboard

[BUG] 在使用staticfile cdn后副标题无法显示

Open Huasushis opened this issue 1 year ago • 9 comments

提交 Issue 前检查清单

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

Huasushis avatar Dec 13 '23 16:12 Huasushis

另外在这个新开的hexo中我也出现了FontAwesome无法正常显示的问题,可能是下载字体的时候请求头出问题了?

Huasushis avatar Dec 13 '23 16:12 Huasushis

Staticfile 目前本地 hexo s 使用 localhost:4000 预览时,会导致 CORS 无法加载资源文件,部署上博客后即可恢复正常。

EvanNotFound avatar Dec 13 '23 16:12 EvanNotFound

Staticfile 目前本地 hexo s 使用 localhost:4000 预览时,会导致 CORS 无法加载资源文件,部署上博客后即可恢复正常。

但是我最开始是部署上到 vercel 上后也没有,换成 bootcdn 就能显示了。

Huasushis avatar Dec 14 '23 05:12 Huasushis

下面是部署后的情况:

image

上图是使用 bootcdn 的情况

然后配置文件改为 staticfile,运行 hexo clean & hexo g & hexo d

image

会发现副标题没有了,而且有字体未下载下来。

控制台报错:

image

使用 chrome 或者 microsoft edge 浏览器访问网站甚至会出现一部分 js 无法从 cdn 下载的情况。

Huasushis avatar Dec 14 '23 15:12 Huasushis

并且发现控制台报错指向的网址都是其他使用了 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’).

等报错。

Huasushis avatar Dec 14 '23 16:12 Huasushis

目前换用 cdnjs 没有问题。

Huasushis avatar Dec 14 '23 16:12 Huasushis

这个应该是 Staticfile 的问题吧,见

bianyukun1213 avatar Dec 14 '23 16:12 bianyukun1213

Statitic file 问题,请使用 CDNJS,等待修复

EvanNotFound avatar Dec 15 '23 00:12 EvanNotFound

跟进:可以正常加载资源,但是编码似乎有点问题

Muska-Ami avatar Dec 15 '23 19:12 Muska-Ami

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Jun 02 '24 02:06 github-actions[bot]