fix: wrong relative url in post navigation

This commit is contained in:
jeffreytse 2020-09-10 12:38:15 +08:00
parent 283b912a9d
commit 2f48f4b117

View file

@ -29,14 +29,14 @@ sidebar:
{%- if result.size == 0 -%} {%- if result.size == 0 -%}
<div class="post-nav"> <div class="post-nav">
{%- if page.previous -%} {%- if page.previous -%}
<a class="previous" href="{{ page.previous.url }}" title="{{ <a class="previous" href="{{ page.previous.url | relative_url }}" title="{{
page.previous.title | escape }}">{{ page.previous.title | escape | truncatewords: 6 }}</a> page.previous.title | escape }}">{{ page.previous.title | escape | truncatewords: 6 }}</a>
{%- else -%} {%- else -%}
<span></span> <span></span>
{%- endif -%} {%- endif -%}
{%- if page.next -%} {%- if page.next -%}
<a class="next" href="{{ page.next.url }}" title="{{ page.next.title | escape }}">{{ page.next.title | escape | truncatewords: 6 }}</a> <a class="next" href="{{ page.next.url | relative_url }}" title="{{ page.next.title | escape }}">{{ page.next.title | escape | truncatewords: 6 }}</a>
{%- else -%} {%- else -%}
<span></span> <span></span>
{%- endif -%} {%- endif -%}
@ -50,7 +50,7 @@ sidebar:
<ul> <ul>
{% assign posts = site[page.collection] | sample:4 %} {% assign posts = site[page.collection] | sample:4 %}
{%- for post in posts -%} {%- for post in posts -%}
<li><a class="post-link" href="{{post.url}}" title="{{ page.next.title | escape }}">{{ post.title | escape | truncatewords: 12 }}</a></li> <li><a class="post-link" href="{{post.url | relative_url}}" title="{{ page.next.title | escape }}">{{ post.title | escape | truncatewords: 12 }}</a></li>
{%- endfor -%} {%- endfor -%}
</ul> </ul>
</div> </div>