summaryrefslogtreecommitdiff
path: root/_includes/views/pagination.html
blob: 014df8526ca744e386b27f7e911ed001f265c762 (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
{%- 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">
    <!-- Top list item -->
    {%- if paginator == site or paginator.page == 1 -%}
      {%- assign post_item_class = "top-post" -%}
      {%- assign posts = site.posts
        | where_exp: "item", "item.top > 0"
        | sort: "top" -%}
      {%- for post in posts -%}
        {%- include views/pagination-item.html -%}
      {%- endfor -%}
    {%- endif -%}

    <!-- Normal list item -->
    {%- assign post_item_class = "" -%}
    {%- for post in paginator.posts -%}
      {%- if post.top -%}
        {%- continue -%}
      {%- endif -%}
      {%- include views/pagination-item.html -%}
    {%- endfor -%}
  </ul>

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