hexo + github pages搭建博客样式加载不出来
搭建hexo博客时样式总是报404加载不出来
对于如何搭建hexo博客网上有很多关于使用hexo + github pages搭建个人博客的博客,按照博客内容也都可以搭建起来。运行后在本地服务器都可以实现访问,但是通过域名访问时却遇到样式加载不出来的问题,查询该问题也没找到清晰的解决方法,在此进行总结。
通过控制台查看样式文件报404,是因为url地址不对。
需要修改_config.yml文件中的url地址和根目录
# URL ## If your site is put in a subdirectory, set url as http://yoursite.com/child and root as /child/ url: https://banjingwei.github.io/ban.github.io root: /ban.github.io/ permalink: :year/:month/:day/:title/ permalink_defaults:
开始确认是这里的问题却不清楚url和root分别该是什么 url是github pages给我们分配的网址 root是我们搭建该博客的仓库名! 这样就可以加载到样式文件了,我们的博客也就展现在了我们面前。可以参考