[英]url of navigations of jekyll posts do not work when pushed to github
我想将导航功能添加到我在github页面上的博客文章中。
我将以下代码添加到我的post.html中:
<div class="PageNavigation">
{% if page.previous.url %}
<a class="prev" href="{{page.previous.url}}">«
{{page.previous.title}}</a>
{% endif %}
...
</div>
当我将帖子推送到github时,由于代码位于存储库URL下,因此该链接将不起作用。 解决方法是,将回购名称手动添加到链接中。 它成为了:
<a class="prev" href="/myRepoName{{page.previous.url}}">«
{{page.previous.title}}</a>
现在的问题是导航在本地不起作用。 有没有简单的解决方案来避免这种混乱?
在_config.yml中 :
baseurl: /myRepoName
链接看起来像:
<a href="{{ site.baseurl }}{{ page.previous.url }}" class="prev">
{{page.previous.title}}
</a>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.