Paginate高度过滤的Jekyll集合

时间:2018-04-13 18:04:09

标签: jekyll liquid liquid-layout jekyll-extensions jekyll-paginator

我正在建立一个ICO网站。该网站包含一个'硬币'集合,该集合包含所有ico硬币页面。然后,我创建了诸如https://moonlandingnetwork.netlify.com/upcomingicohttps://moonlandingnetwork.netlify.com/activeico等页面,以根据它们是即将到来,活动还是已结束来显示这些硬币。我使用此代码根据日期和硬币是否具有特征来过滤这些硬币。

{% assign featuredcoins = site.coins | where: ‘ico.featured’, ‘true’ %}
{% assign regularcoins = site.coins | where: ‘ico.featured’, ‘false’ %}
{% assign timeframe = 86400 %}
{% assign current_date = “now” | date: “%s” | minus: timeframe %}

{% assign featuredUpcoming = “” | split: ‘,’ %}
{% for coin in featuredcoins %}
{% assign pre_ico_end_date = coin.pre-ico.end-date | date: “%s” | plus: 0 %}
{% assign ico_start_date = coin.ico-detail.start-date | date: “%s” | plus: 0 %}
{% if current_date > pre_ico_end_date and ico_start_date > current_date %}
{% assign featuredUpcoming = featuredUpcoming | push: coin %}
{% endif %}
{% endfor %}

{% assign regularUpcoming = “” | split: ‘,’ %}
{% for coin in regularcoins %}
{% assign pre_ico_end_date = coin.pre-ico.end-date | date: “%s” | plus: 0 %}
{% assign ico_start_date = coin.ico-detail.start-date | date: “%s” | plus: 0 %}
{% if current_date > pre_ico_end_date and ico_start_date > current_date %}
{% assign regularUpcoming = regularUpcoming | push: coin %}
{% endif %}
{% endfor %}

{% for coin in featuredUpcoming limit: 2 %}
<li>Featured Coin</li>
{% endfor %}

{% for coin in regularUpcoming %}
<li>Regular Coin</li>
{% endfor %}

我被困在哪里,我需要对此进行分页。我知道杰基尔不支持收藏品的分页。在我的研究中,我遇到了Jekyll paginate V2,Octopress Paginate和这段代码https://gist.github.com/Phlow/5613fb3f18946f577f071e2a258749a3。但我无法让任何人工作。

我还要求分页的工作方式是每个新页面上的特色硬币和常规硬币一起变化。有人可以帮我指导我应该做的事情。

0 个答案:

没有答案