Create index.md files in _posts and its subdirectories

Hello, there!

I’m looking for a method to categorize post entities (*.md or *.html in _post) based on a specific hierarchy.

For example, I want my directory structure like this:

_posts
-- Category A
---- Subcategory a
-- Category B
---- Subcategory b
---- Subcategory c

What I’ve tried is adding permalink: /:path.html in _config.yml file; then I got the following _site materials after jekyll build.

_site
-- 2024-01-01-post-01.md
-- Category A
---- 2024-01-02-post-02.md
---- Subcategory a
------ 2024-01-03-post-03.md
------ 2024-01-04-post-04.md
-- Category B
---- 2024-01-05-post-05.md
---- Subcategory b
---- Subcategory c
------ 2024-01-06-post-06.md

Pretty looks nice though, BUT there is no index.md file in each directory (also including root directory). So when I access to URL such as localhost:4000/Category%20A, blank page appears on my web browser.

I want a specific html layout to be applied to all of the category paths (/, /Category A, /Category A/Subcategory a, and so on.). To do so, it seems necessary to place index.md files inside every subdirectory.

Is there any simple solution?

normally jekyll puts every file in a folder with the name of the file and then an index.html file is inside that. Most webservers will serve the index.html file when you hit the path to the folder with a trailing slash.

By adding the .html in the path you are changing this in a way that I think is not the best (but don’t hold me to that).

I would stick to pretty personally.

is the screenshot above with it set to pretty? that does not seem right to me. That looks more like the path.html version.

image

you should not end up with any .md files in the site folder - unless maybe you didn’t have front matter in them?