Jekyll:在同一页面显示所有帖子

Con*_*ors 7 blogs jekyll

我一直在阅读Jekyll Docs 上的所有内容,但我找不到办法做到这一点。

默认情况下,在生成网页时,jekyll 会显示您所有博客文章的链接列表。有没有办法在同一页面中显示所有博客文章的内容?(alla blogspot/wordpress/传统博客...)

干杯

Con*_*ors 4

从以下位置找到了我的解决方案:本教程,其中包括编辑index.md并添加以下内容:

  {% for post in site.posts %}
  <article>
    <h2>
      <a href="{{ post.url }}">
        {{ post.title }}
      </a>
    </h2>
    <time datetime="{{ post.date | date: "%Y-%m-%d" }}">{{ post.date | date_to_long_string }}</time>
    {{ post.content }}
  </article>
{% endfor %}
Run Code Online (Sandbox Code Playgroud)

  • 这也在 Jekyll 文档中 https://jekyllrb.com/docs/posts/#displaying-an-index-of-posts (3认同)