Mat*_*mas 2 permalinks jekyll github-pages
我正在编写在 GitHub Pages 上设置 Jekyll的指南。我的 GitHub 存储库发布到~.github.io/hello-pages,所以我很自然地插入{{ site.baseurl }}锚标记等。这很好用。
什么是不工作的永久链接:我必须手动拼出来permalink: /hello-pages/blog/:year/:month/:day/:title.html的_config.yml任何固定链接工作的; 否则他们链接到例如~.github.io/blog/x/y/z而不是~.github.io/hello-pages/blog/x/y/z像我期望的那样。
手动指定baseurl: /hello-pages无效(我想 GitHub 的 Jekyll 配置已经这样做了)。
在任何地方手动输入“/hello-pages”似乎是一种我想避免的严格设计。一个较旧的 SO 答案说永久链接应该“正常工作”。是什么赋予了?
编辑
我正在构建这样的损坏的 URL:
<a href="{{ post.url }}">
我只是想通了我做错了什么。我需要做以下事情之一。这是关于此的文档:https : //jekyllrb.com/docs/templates/#filters
<a href="{{ post.url | relative_url }}">这会将 URL 转换为相对 URL,并将基本 URL 考虑在内。
<a href="{{ post.url | absolute_url }}">与上述相同,但使用绝对 URL。
<a href="{{ post.url | prepend:site.baseurl }}">将基本 URL 附加到永久链接。
| 归档时间: |
|
| 查看次数: |
1120 次 |
| 最近记录: |