Working with categories within categories

It’s not painfully obvious at first but Jekyll treats additional items in the categories array as subcategories (at least when used in the URL for a post). For example:

categories: [art, geometric art]

Will give you the parent category as art and the sub as geometric art.
And if you use the following permalink structure in your _config.yml:

permalink: /:categories/:title/

You’ll get nice URLs like /art/geometric-art/your-post/

Jekyll also allows you to group posts by subfolders under _posts and I believe it will assign the category this way. So in theory a file like _posts/art/geometric-art/2019-02-22-your-post.md would give you something like /art/geometric-art/your-post/ as well.

And have category assignments of art and geometric-art.

1 Like