jekyll - 仅显示 Jekyll 中 future 的帖子

标签 jekyll github-pages

有没有办法在 Jekyll 中创建一个循环,只显示从今天开始到 future 按时间顺序排列的帖子?我正在为聚会小组创建 GitHub Pages 网站,但我有点陷入困境。

最佳答案

下面的代码可以做到这一点:

{% assign curDate = site.time | date: '%s' %}
{% for post in site.posts %}
    {% assign postStartDate = post.date | date: '%s' %}
    {% if postStartDate >= curDate %}
        Post datas here
    {% endif %}
{% endfor %}

但是您需要每天“构建”您的网站,因为 Github 仅在推送到您的存储库时更新。

关于jekyll - 仅显示 Jekyll 中 future 的帖子,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24353638/

相关文章:

html - 如何对 HTML 元素进行分组,以便它们在具有 "columns"样式的 div 中一起移动?

ruby - Jekyll 中的缓慢再生

ruby - JekyllRB : how to create an online book (force permalink to be like chapter/1)

jekyll - 如何使用 Jekyll 的液体模板循环浏览类别,然后循环浏览该类别中的帖子?

github - 我有一个 github 网页。如何制作纯粹显示 pdf 的页面?即我的简历?

Github 页面 : Custom domain setup with Hover

docker - Windows 10 Pro上的Docker:构建新的Jekyll网站时出现错误文件冲突

jekyll - 无法预览 Github 页面

Javascript 模块无法在 github 页面上运行

angular - 如何部署支持 ssl 的 Angular 应用程序