我正在建立一个 ICO 网站。该网站包含一个“硬币”集合,该集合包含所有 ico 硬币页面。然后,我创建了诸如https://moonlandingnetwork.netlify.com/upcomingico、https://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 不支持集合的分页。我在研究中遇到了 Jekyll paginate V2、Octopress Paginate 和此代码https://gist.github.com/Phlow/5613fb3f18946f577f071e2a258749a3。但我无法让其中任何一个工作。
我还要求分页以这样一种方式工作,即特色硬币在每个新页面上都会随着常规硬币而变化。有人可以帮助我指导我应该做什么。