feat: truncate words for post navigation
This commit is contained in:
parent
bf7c0b1c50
commit
01a36696e6
1 changed files with 3 additions and 5 deletions
|
@ -22,15 +22,13 @@ sidebar:
|
||||||
<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 }}" title="{{
|
||||||
page.previous.title | escape }}">{{ page.previous.title | escape |
|
page.previous.title | escape }}">{{ page.previous.title | escape | truncatewords: 6 }}</a>
|
||||||
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 |
|
<a class="next" href="{{ page.next.url }}" title="{{ page.next.title | escape }}">{{ page.next.title | escape | truncatewords: 6 }}</a>
|
||||||
escape }}">{{ page.next.title | escape | truncatewords: 6 }}</a>
|
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
<span></span>
|
<span></span>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
@ -41,7 +39,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}}">{{post.title}}</a></li>
|
<li><a class="post-link" href="{{post.url}}" title="{{ page.next.title | escape }}">{{ post.title | escape | truncatewords: 12 }}</a></li>
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue