blog/_includes/views/pagination.html

41 lines
1.2 KiB
HTML
Raw Normal View History

2019-09-11 06:19:34 +02:00
{%- if page.paginator -%}
{%- assign paginator = page.paginator -%}
{%- elsif paginator == nil -%}
{%- assign paginator = site -%}
{%- endif -%}
{%- if paginator.posts.size > 0 -%}
<div class="pagination">
<!-- Post list links -->
<ul class="post-list">
{%- for post in paginator.posts -%}
<li>
{%- assign date_format = site.yat.date_format | default: "%b %-d, %Y" -%}
2020-07-12 10:23:23 +02:00
<h2 class="post-title">
2019-09-11 06:19:34 +02:00
{%- assign post_url = post.url | relative_url -%}
<a class="post-link" href="{{ post_url }}">
{{ post.title | escape }}
</a>
2020-07-12 10:23:23 +02:00
</h2>
<div class="post-meta">
<span class="post-date">{{ post.date | date: date_format }}</span>
</div>
2019-09-11 06:19:34 +02:00
<p class="post-excerpt">
{{ post.content | strip_html | truncatewords: 50 }}
</p>
2020-07-12 10:23:23 +02:00
<div class="post-tags">
{%- for tag in post.tags -%}
<a class="post-tag" href="/tags.html#{{tag}}">#{{tag}}</a>
{%- endfor -%}
</div>
2019-09-11 06:19:34 +02:00
</li>
{%- endfor -%}
</ul>
<!-- Pagination links -->
{%- if paginator.posts.size < site.posts.size -%}
{%- include views/paginator.html -%}
{%- endif -%}
</div>
{%- endif -%}