简体   繁体   中英

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?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM