summaryrefslogtreecommitdiff
path: root/_includes/views/pagination.html
blob: bcc362065a613e3acae6c99348e0a5334e31909b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{%- 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" -%}

      {% assign article = post.content %}
      {%- include functions.html func='get_reading_time' -%}
      {% assign reading_time = return %}

      <h2 class="post-title">
        {%- assign post_url = post.url | relative_url -%}
        <a class="post-link" href="{{ post_url }}">
          {{ post.title | escape }}
        </a>
      </h2>
      <div class="post-meta">
        <span class="post-date"><i class="fa fa-calendar"></i> {{ post.date | date: date_format }}</span>
        <span class="post-reading-time left-vsplit"><i class="fa fa-clock-o"></i> {{ reading_time }}</span>
      </div>
      <p class="post-excerpt">
        {{ post.content | strip_html | truncatewords: 50 }}
      </p>
      <div class="post-tags">
        {%- for tag in post.tags -%}
        <a class="post-tag" href="/tags.html#{{tag}}">#{{tag}}</a>
        {%- endfor -%}
      </div>
    </li>
    {%- endfor -%}
  </ul>

  <!-- Pagination links -->
  {%- if paginator.posts.size < site.posts.size -%}
    {%- include views/paginator.html -%}
  {%- endif -%}
</div>
{%- endif -%}