Search code examples
jekyllgithub-pages

How can I create a directory for each category under _posts in Jekyll?


I am trying to have such a structure in my Jekyll site:

_posts php 2014-10-31-this-is-a-test.md ruby 2014-12-01-some-other-test.md

I would like all posts in the php directory to be in the PHP category, and all posts in ruby to be in the Ruby category. Here is my _config.yml file:

defaults: - scope: path: "" type: "posts" values: layout: post comments: true share: true - scope: path: "_posts/php" type: "posts" values: category: PHP - scope: path: "_posts/ruby" type: "posts" values: category: Ruby

However, this doesn't work. Any ideas?


Solution

  • path: "php" or path: "ruby" sets the category.

    Note: any category set in the front matter will replace the one in default config.