Search code examples
octopress

In Octopress, how to create a folder similar as blog folder and list archives files?


I use Octopress write my blog.

I like write some notes, and don't want publish them as blog. So I create a fold named note in source folder, and put some markdown file in it. see source code structure

It works, but I don't know how to list all note archives' title and link in one page. Now I list them manually, see code.

My questions are:
Is my solution (create a new folder) the best way ?
How to write code list files instead of update manually ?


Solution

  • For this, you can use jekyll collections.

    In your _config.yml, add :

    collections:
      notes:
        output: true
    

    Rename your note folder to _notes

    And you can now list all your notes with :

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