Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在_config.yml中配置了root: /blog/,但css文件还有js文件依然是从根目录加载的 #391

Closed
crystalYY opened this issue Jan 8, 2017 · 11 comments

Comments

@crystalYY
Copy link

在yilia主题的_config.yml中配置了root: /blog/
在hexo的config.yml中url和root分别是:
url: https://crystalyy.github.io/blog
root: /blog/

尝试过clean了之后重新部署,还是一样的问题。
查找了一些资料,看到有人说修改了root之后需要等一段时间才能生效,于是昨天晚上十点左右出了问题我就暂时没管,今天再看还是不行。再次clean之后重新deploy也还是不行。

我手动修改了index.html的css的href之后样式是可以正常显示的

浏览器报错如下

https://crystalyy.github.io/main.d221b8.css Failed to load resource: the server responded with a status of 404 (Not Found)
https://crystalyy.github.io/main.d221b8.js Failed to load resource: the server responded with a status of 404 (Not Found)
https://crystalyy.github.io/blog/null Failed to load resource: the server responded with a status of 404 (Not Found)
https://crystalyy.github.io/slider.59dfdc.js Failed to load resource: the server responded with a status of 404 (Not Found)
https://crystalyy.github.io/main.d221b8.css Failed to load resource: the server responded with a status of 404 (Not Found)

我换了landscape主题后显示是正常的

系统是win10的系统

博客地址:https://crystalyy.github.io/blog/

真诚期待答复

@litten
Copy link
Owner

litten commented Jan 8, 2017

很详细的信息,有劳了。
这是我的疏忽,下午修改好。

@litten litten closed this as completed in 4d60201 Jan 8, 2017
@litten
Copy link
Owner

litten commented Jan 8, 2017

已修复,请更新确认一下。

@crystalYY
Copy link
Author

已更新,页面可以正常显示,谢谢,辛苦了。

@sxqs-yang
Copy link

sxqs-yang commented Mar 16, 2017

您好,我依然遇到了这样的问题。在本地服务器使用时,在所有文章选项中点击文章标题,跳转的链接中缺失根目录/blog/。我查看了您修改过的ejs文件记录,与本机对照并没有发现问题。不知道这个该如何解决。麻烦您了。

@litten
Copy link
Owner

litten commented Mar 16, 2017

@sxqs-yang 参考下根目录的配置
https://github.com/litten/BlogBackup/blob/master/_config.yml

我怀疑是你的root字段写了一级blog

@sxqs-yang
Copy link

大神,很抱歉再次打扰您。我的url和root是这样设置的:
url: https://sxqs-yang.github.io/blog
root: /blog/
确实是按照您config中的注释写的。在theme的config文件中也设置了同样的root。
正常点击文章标题没问题,就是在点击侧边栏的所有文章,弹出目录之后点击文章题目。比如说正确访问的目录为:https://sxqs-yang.github.io/blog/2017/03/15/hello-world/
而跳转的文章目录变成了:https://sxqs-yang.github.io/2017/03/15/hello-world/。
改了好多好多次都没有成功,不知道是哪里的问题。非常抱歉再次麻烦您……非常感谢。

@litten
Copy link
Owner

litten commented Mar 16, 2017

@sxqs-yang

你的写法跟上面链接里的写法不一致呀,为什么说是“按照config中的注释写的”呢?
改成这样:

url: //sxqs-yang.github.io
root: /

还是说你希望加一级blog目录?

@sxqs-yang
Copy link

sxqs-yang commented Mar 16, 2017

@litten 大神:
注释不是说:## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
然后我就在github上生成了这个网址url://sxqs-yang.github.io/blog,所以我希望以/blog/作为根目录。
是不是我理解错了……新手愚笨,谢谢您的耐心解答。

@litten
Copy link
Owner

litten commented Mar 16, 2017

@sxqs-yang
我明白你的意思了,那应该设置成:

url: //sxqs-yang.github.io
root: /blog/

这个注释有点问题,我的锅

@sxqs-yang
Copy link

@litten
非常感谢大神深夜解答~嗯嗯,我明天更改,非常感谢

@wuhou123
Copy link

wuhou123 commented Jul 2, 2017

@sxqs-yang
问题解决了吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants