Reputation: 732
I wanted to add the navigation capability to my blog posts on github pages.
I added the following code into my post.html:
<div class="PageNavigation">
{% if page.previous.url %}
<a class="prev" href="{{page.previous.url}}">«
{{page.previous.title}}</a>
{% endif %}
...
</div>
When I push the posts to github, the link will not work due to the fact that code is residing under a repository url. As a workaround, I added the repo name manually to the link. It becomes:
<a class="prev" href="/myRepoName{{page.previous.url}}">«
{{page.previous.title}}</a>
Now the problem is that the navigation is not working locally. Is there a simple solution to avoid this mess?
Upvotes: 1
Views: 309
Reputation: 52829
In _config.yml :
baseurl: /myRepoName
Link looks like :
<a href="{{ site.baseurl }}{{ page.previous.url }}" class="prev">
{{page.previous.title}}
</a>
Upvotes: 3