With the new website I wanted 2 sources of posts, regular blog posts and projects. This boils down to having 2 separate index pages, one for my blog posts and one for my projects. The issue with jekyll/Octopress is that all valid files in any _posts directory are all combinied into one big list. Jekyll/Octopress doesn’t differentiate the posts stored in different places on the file system. I wanted two separate index pages. One would list all my blog posts in the standard blog index format and the other would be a different layout listing all my projects.

I found this thread as well as this post detail how to use the categories attribute in the yaml front matter to distinguish which blog posts are part of. However, I wanted to use the category attribute to produce a categorized list of all my projects. What I found is that all variables in the yaml front matter are available so I can use effectively the same method as the category one but checking against the value of the layout variable instead of category. This works great for me since my blog posts and project “posts” have completely different layouts anyway.

Example yaml front matter

When creating a post I just have to make sure that for blog posts my yaml front matter includes a layout: post line as shown below:

and projects include a layout: project line:

I then made sure that there were layout files called post.html and project.html in my source/_layout directory in Octopress.

Index pages

Then, when creating my blog index page, I just have to check if layout = 'post'

For the projects list I manually list the categories right now. So, for example, the “Research” section of my projects list looks like


The last step was to make sure that creating new posts via the Rakefile automatically add the layout directive. My new post task now looks like:

I also wanted to add a task called new_project to create a new project file similar to how to create new Octopress posts. That task also adds a bunch of extra fields that the project layout uses for my projects like a teaser image, and links for demo videos, citations, websites, etc. My new project task looks like


That’s it! Now I can have as many sub blogs as I want and keep the category field available for categorizing posts.