【问题标题】:How to create sorted list of Pages in Octopress or Jekyll?如何在 Octopress 或 Jekyll 中创建页面排序列表?
【发布时间】:2014-03-13 20:48:49
【问题描述】:

我有一个 Octopress 网站,其中包含帖子和页面。现在我想添加另一类页面,我想将其称为writepus(我将通过 git 提交像 wiki 一样不断更新的注释)。

我想将这些笔记保存在一个名为 _notes 的文件夹中,就像我们在 Octopress 的 source 文件夹中拥有 _posts 一样。

我有一个名为 _writeups/ 的文件夹,其中包含以下文件:

subject1.html
subject2.html

我有一个名为notes/list.html 的文件,其内容如下。

---
layout: page
navbar: Notes
title: Notes
footer: false
---

<div id="blog-archives">
{% for post in site.writeups reverse %}
{% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
{% unless year == this_year %}
  {% assign year = this_year %}
  <h2>{{ year }}</h2>
{% endunless %}
<article class="page-header">
  {% include archive_post.html %}
</article>
{% endfor %}
</div>

基本上,我想创建这些文章的列表,以便我可以在有时间时不断更新它们。我还想将这些与postspages 分开。

如何使用 Octopress / Jekyll 实现此功能?

【问题讨论】:

    标签: ruby jekyll octopress jekyll-extensions


    【解决方案1】:

    最近才发布的 Jekyll 版本 2 能够拥有额外的 collectionsdata。 Collections 可能是您正在寻找的东西,因此请升级您的 Jekyll 版本并访问 http://jekyllrb.com/docs/collections/ 以了解有关它们的更多信息。

    【讨论】:

    • 感谢您的指点。让我安装新版本并尝试一下。
    猜你喜欢
    • 1970-01-01
    • 2015-02-28
    • 1970-01-01
    • 1970-01-01
    • 2021-12-25
    • 1970-01-01
    • 1970-01-01
    • 2012-02-20
    • 1970-01-01
    相关资源
    最近更新 更多