【问题标题】:In Octopress, how to create a folder similar as blog folder and list archives files?在 Octopress 中,如何创建类似于博客文件夹的文件夹并列出存档文件?
【发布时间】:2015-02-28 09:20:41
【问题描述】:

我用 Octopress 写博客。

我喜欢写一些笔记,不想将它们发布为博客。 所以我在source 文件夹中创建了一个名为note 的折叠,并在其中放入了一些降价文件。 see source code structure

它有效,但我不知道如何在一页中列出所有笔记档案的标题和链接。现在我手动列出它们,see code

我的问题是:
我的解决方案(创建一个新文件夹)是最好的方法吗?
如何编写代码列表文件而不是手动更新?

【问题讨论】:

    标签: octopress


    【解决方案1】:

    为此,您可以使用jekyll collections

    在您的 _config.yml 中,添加:

    collections:
      notes:
        output: true
    

    将您的 note 文件夹重命名为 _notes

    您现在可以列出所有笔记:

    <ul>
    {% for note in site.notes %}
      <li><a href="{{site.baseurl}}{{ note.url }}">{{ note.title }}</a></li>
    {% endfor %}
    </ul>
    

    【讨论】:

    • 谢谢,它有效! (PS:如果不行,更新Octopress到新版本)
    猜你喜欢
    • 2013-09-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多