Listing Categories by Blog

Technically, you can create two blogs on one site, and there are many examples of how to do that. I created a video series on Jekyll and came up with one of many approaches in the video link at the bottom of this post.

I think what you really want is a URL that looks like this:

https://www.mysite.com/categories?category=cars

The result would be a page that displays the blog items you have that talk about the category of cars. Whenever there is a new category, the link changes to that name, and you are good to go. Sounds good, right? Unfortunately, In a Jekyll/static site world, you cannot programmatically figure something out at runtime, so you have to create individual files to handle the routing, but it is pretty easy to do that.

You can create a folder called categories and then create a file per each (yes, you still need to do the heavy lifting, but the page would be easy to create).

Create a page in the categories folder and call it cars.md with whatever front matter you want, like:

---
layout: default
category: cars
---

Now, in the default layout (or whatever layout you create), you would have code somewhere in there that looks like this:

{%- assign posts = site.posts | where_exp: 'post', 'post.category == category -%}
{%- for post in posts -%}
  your html and code here...
{%- endfor -%}

If you create a new category and call it trucks, add another file in the category folder, call it trucks.md, and update the front YAML front matter with category: trucks.

Jekyll does have a capability referred to as collections, where you can create a grouping of any data, like a second blog, for example. Here are the official docs:

I think the following thread covers a lot of your questions in a slightly different context, but still what I think you are asking for:

Here is a video I created a while back with one way you can have multiple blogs on a single site. I do not think this is what you want, but it could be helpful! It is part of a training series, so it assumes you have a Jekyll site set up locally with the default minima theme.