在我的计算机上,我访问URL http://127.0.0.1:4000上的测试网页.在服务器上,它将在
GitHub页面上,这意味着https://username.github.io/repo-name/.
在_config.yml中,我看到以下相关设置:
# Uncomment if you are planning to run the blog in a subdirectory # Note - if you enable this,and attempt to view your site locally you have to use the baseurl in your local path. # Example,you must use http://localhost:4000/path/to/blog #baseurl: /path/to/blog baseurl: # The URL of your actual domain. This will be used to make absolute links in the RSS Feed. url: http://yourdomain.com/
所以对于GitHub服务器我需要它:
baseurl: /repo-name/ url: https://username.github.io/
但是在localhost上,它必须是:
baseurl: url: http://127.0.0.1:4000
这些设置是必要的,因为没有它们,我将为使用相对路径的资源获得404错误:
<script src="js/ghapi.js"></script>
"NetworkError: 404 Not Found - http://127.0.0.1:4000/download/js/ghapi.js"
路径应该是http://127.0.0.1:4000/js/ghapi.js但是由于页面是/ download,它被添加到脚本文件的相对URL.
我需要处理这个问题,我该怎么做?
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。