summaryrefslogtreecommitdiff
path: root/_layouts
diff options
context:
space:
mode:
authorjeffreytse <jeffreytse.mail@gmail.com>2020-07-16 12:15:26 +0800
committerjeffreytse <jeffreytse.mail@gmail.com>2020-07-16 12:15:26 +0800
commit01a36696e666d5b05d45aa9ec03f91f59725223d (patch)
treec3b5edc49563cde1724d2e56c8312f1ba589c5d5 /_layouts
parentbf7c0b1c505364582c030ffb14b3b3827e999da8 (diff)
feat: truncate words for post navigation
Diffstat (limited to '_layouts')
-rw-r--r--_layouts/post.html8
1 files changed, 3 insertions, 5 deletions
diff --git a/_layouts/post.html b/_layouts/post.html
index 364b76c..751b984 100644
--- a/_layouts/post.html
+++ b/_layouts/post.html
@@ -22,15 +22,13 @@ sidebar:
<div class="post-nav">
{%- if page.previous -%}
<a class="previous" href="{{ page.previous.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 -%}
<span></span>
{%- endif -%}
{%- 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 }}" title="{{ page.next.title | escape }}">{{ page.next.title | escape | truncatewords: 6 }}</a>
{%- else -%}
<span></span>
{%- endif -%}
@@ -41,7 +39,7 @@ sidebar:
<ul>
{% assign posts = site[page.collection] | sample:4 %}
{%- 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 -%}
</ul>
</div>