summaryrefslogtreecommitdiff
path: root/_includes/views/pagination.html
blob: a9de0740e64c38f93c673395300e5a0ab4adea6c (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
{%- if page.paginator -%}
  {%- assign paginator = page.paginator -%}
{%- elsif paginator == nil -%}
  {%- assign paginator = site -%}
{%- endif -%}

{%- assign name = 'excerpt.image_style' -%}
{%- include functions.html func='get_value' default='z' -%}
{%- assign image_style = return | append: '-image-style' -%}

{%- if paginator.posts.size > 0 -%}
<div class="pagination">
  <!-- Post list links -->
  <ul class="post-list {{ image_style }}">
    <!-- 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 -%}