主题在 Octopress 中不适用于自定义域
Theme is not working in Octopress for a custom domain
我最近将我的博客从 Wordpress 迁移到了 Octopress。
URL 的博客是:
myproject.github.io/octopress
后来我在我的 Wordpress 站点的 DNS 设置中添加了一条 A 记录:
myexample.com points to 192.30.252.154
问题:
在浏览器中从 myexample.com 加载 Octopress 博客后,标准主题不会加载,而从 myproject.github.io做。在这两种情况下都会加载文本、图片等其他媒体。
感谢任何帮助!
这是因为您使用两种不同的 url 方案:myexample.com
和 username.github.io/octopress
。这里的主要区别是 /octopress
路径。
这应该在 _config.yml
中考虑到:
# If publishing to a subdirectory as in site.com/project set 'root: /project'
root: /
从yourdomain.com
的角度来看,应该是/
,从username.github.io/octopress
的角度来看,应该是/octopress
。
在其中一种情况下,这会中断资源加载。
但这里的主要问题是自定义域和 github url.
的混合
您最好将 CNAME
文件放在 username.github.io
存储库中,这将使 github 将所有请求重定向到 username.github.io
到 yourdomain.com
。所有对 username.github.io/repository
的请求到 yourdomain.com/repository
.
每个存储库只有一个 url,并且 octopress 配置不会再出现错误。
通过设置配置变量url: http://yoursite.com
,您还将解决由这个双重url 问题产生的规范问题。由于 SEO 和重复内容。
我最近将我的博客从 Wordpress 迁移到了 Octopress。
URL 的博客是:
myproject.github.io/octopress
后来我在我的 Wordpress 站点的 DNS 设置中添加了一条 A 记录:
myexample.com points to 192.30.252.154
问题: 在浏览器中从 myexample.com 加载 Octopress 博客后,标准主题不会加载,而从 myproject.github.io做。在这两种情况下都会加载文本、图片等其他媒体。
感谢任何帮助!
这是因为您使用两种不同的 url 方案:myexample.com
和 username.github.io/octopress
。这里的主要区别是 /octopress
路径。
这应该在 _config.yml
中考虑到:
# If publishing to a subdirectory as in site.com/project set 'root: /project'
root: /
从yourdomain.com
的角度来看,应该是/
,从username.github.io/octopress
的角度来看,应该是/octopress
。
在其中一种情况下,这会中断资源加载。
但这里的主要问题是自定义域和 github url.
的混合您最好将 CNAME
文件放在 username.github.io
存储库中,这将使 github 将所有请求重定向到 username.github.io
到 yourdomain.com
。所有对 username.github.io/repository
的请求到 yourdomain.com/repository
.
每个存储库只有一个 url,并且 octopress 配置不会再出现错误。
通过设置配置变量url: http://yoursite.com
,您还将解决由这个双重url 问题产生的规范问题。由于 SEO 和重复内容。