【问题标题】:Why isn't {{ page.date }} working in my jekyll install?为什么 {{ page.date }} 在我的 jekyll 安装中不起作用?
【发布时间】:2015-06-27 23:05:08
【问题描述】:

我在 github pages 站点上安装了我的旧博客,并将其从 textpattern 转移到 jekyll。它位于名为/journal 的子目录中。个别帖子显示帖子的日期没有问题。

/journal/index.html page, {{ page.date | date: "%x" }} 上根本不起作用。

我需要添加什么才能使日期显示在博客的索引页面上?

【问题讨论】:

    标签: jekyll


    【解决方案1】:

    如果您在index.html 中循环查看您的帖子,那么您需要使用帖子的日期而不是page.date。它看起来像这样:

    {% for post in paginator.posts %}
        {{ post.date | date: "%x" }}
    {% endfor %}
    

    【讨论】:

    • 我将其更改为 {{ post.dateendfor %}。完美地工作。谢谢你! ;)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-13
    • 2021-10-26
    • 1970-01-01
    • 2015-05-29
    • 1970-01-01
    • 2012-07-31
    相关资源
    最近更新 更多