0
votes

I have a project where I have posts on main page of the blog and I would love to have another posts folder inside subfolder(s).

I am talking about this structure:

_posts
_posts/2020-04-04-Testmain.md
subpage/_posts
subpage/_posts/2020-04-04-Testsub.md
subpage/index.html
index.html

I can access posts from subpage by using {% for post in site.categories.subpage %} inside subpage/index.html but I can't find a way how to force jekyll to also generate posts in the subpage folder so I can access it at page http://127.0.0.1:4000/subpage/testsub

Is it even possible? Or is it better to follow this structure?

_posts
_posts/2020-04-04-Testmain.md
_posts/subpage
_posts/subpage/2020-04-04-Testsub.md

If so, is there some setting required to make the post at http://127.0.0.1:4000/subpage/testsub ?

1

1 Answers

0
votes

Found the solution!

In _config.yml you can use permalink: /:categories/:title

And with following file hierarchy:

_posts
_posts/2020-04-04-Testmain.md
subpage/_posts
subpage/_posts/2020-04-04-Testsub.md
subpage/index.html
index.html

You will get these websites:

http://127.0.0.1:4000/
http://127.0.0.1:4000/subpage/
http://127.0.0.1:4000/subpage/testsub

And you can still access all posts from selected subfolder with {% for post in site.categories.subpage %}