Sha256: e352a312736a5ec5021025ac2596e10fccf6295ca68a963012b9e8a9201f0126

Contents?: true

Size: 1.67 KB

Versions: 6

Compression:

Stored size: 1.67 KB

Contents

{% assign pin_posts = site.posts | where: "pin", "true" | sort: "date" | reverse %}
{% assign unpin_posts = site.posts | where: "pin", nil | sort: "date" | reverse %}
{% assign pin_posts_num = pin_posts | size %}
{% assign unpin_posts_num = unpin_posts | size %}
{% assign page_num = paginator.page %}
{% assign min_num = page_num | minus: 1 | times: site.pagination.per_page %}
{% assign max_num = page_num | times: site.pagination.per_page %}

{% if pin_posts_num <= min_num %}
    {% assign unpin_start = min_num | minus: pin_posts_num %}
    {% if unpin_posts_num < max_num%}
        {% assign unpin_end = unpin_posts_num | minus: 1 %}
    {% else %}
        {% assign unpin_end = max_num | minus: 2 %}
    {% endif %}
    {% for i in (unpin_start..unpin_end) %}
        {% assign post = unpin_posts[i] %}
        {% include layouts/paginate-article.html %}
    {% endfor %}
{% elsif pin_posts_num < max_num %}
    {% assign pin_end = pin_posts_num | minus: 1 %}
    {% for i in (min_num..pin_end) %}
        {% assign post = pin_posts[i] %}
        {% include layouts/paginate-article.html %}
    {% endfor %}
    {% assign unpin_end = max_num | minus: pin_posts_num | minus: 1 %}
    {% if unpin_end >= unpin_posts_num %}
        {% assign unpin_end = unpin_posts_num | minus: 1 %}
    {% endif %}
    {% for i in (0..unpin_end) %}
        {% assign post = unpin_posts[i] %}
        {% include layouts/paginate-article.html %}
    {% endfor %}
{% else %}
    {% assign pin_start = min_num %}
    {% assign pin_end = max_num | minus: 1 %}
    {% for i in (pin_start..pin_end) %}
        {% assign post = pin_posts[i] %}
        {% include layouts/paginate-article.html %}
    {% endfor %}
{% endif %}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jekyll-theme-h2o-ac-1.5.0 _includes/layouts/paginate.html
jekyll-theme-h2o-ac-1.4.0 _includes/layouts/paginate.html
jekyll-theme-h2o-ac-1.3.6 _includes/layouts/paginate.html
jekyll-theme-h2o-ac-1.3.5 _includes/layouts/paginate.html
jekyll-theme-h2o-ac-1.3.4 _includes/layouts/paginate.html
jekyll-theme-h2o-ac-1.3.1 _includes/layouts/paginate.html