Hello dear Jekyllrb Community.
It’s my first time here, so hello to everyone.
I’m currently in the process of revamping my wordpress-based blog (7php.com) into fully the jekyllrb way.
I have spent like 2 weeks now playing with jekyllrb, installing & hacking plugins, even contributing where I can, namely here.
My Question
I would like to gain a bit more control on how I work with posts & even pages.
My posts consist of:
normal blog posts
pages
image posts - An image with a title & a very short description
My concern is, all those “posts” scatter too much around in the same folder. Is there a way I can instruct Jekyllrb so that l “internally” categorise posts into the following hierarchy:
If I understand correctly you should be able to do that with permalinks without too much trouble.
Also, if I remember correctly, the directory structure can also be used to set the category - I believe the way you have it - (_posts at the top) the sub folders will be ignored. You can also do it the other way around and the folder above _posts becomes the category. So the way you have it the folder structure can just be for you to help organize them and will not effect the category. At least I think that is correct.
Then you just need to play with the permalink to get the url the way you want it.
Generally with jekyll there is no need to know ruby, I know zero ruby but get along well with jekyll. Understanding yaml and liquid is what you need.
@rdyar thanks for the reply.
The only issue is I am not using the date permalink.
My permalink is custom:
permalink: :slug/
So what do you suggest to achieve the hierarchy - this is just for my own internal convenience, not for the generated output.
UPDATED:
Hey @rdyar surprisingly for me, this just seemed to be working out of the box. I have just to test it with the folder hierarchy I mentioned, and to my great surprise no configuration is needed, Jekyll loops through inner folders to find any Markdown file and it renders it, respecting the permalink!! FANTASTIC!!
I guess I should just have tried it, I’m thinking too much as a programmer, I need to take a step back. cheers
Is there any way I can stop the current default behaviour of finding the posts by as YYYY-MM-DD-[slugified_title].md and simply by as [slugified_title].md
Posts have to have the date prepended, that is a requirement of anything in the _posts directory to actually work like a post.
pages are not posts, and should not be inside the _posts directory. I wouldn’t even put them in a _pages directory. Anything with an _ is either special (layouts, includes, sass, posts, collections) or is ignored I think.
I also think it is confusing to use a folder named _pages as a page is a thing in jekyll - basically a page is any web page on the site with front matter other than a post or a collection item, and there is no need for them to be in a special directory/folder.
All four examples above are correct - the top two are correct behavior, bottom ones not.
Ultimately there are only a few things special about posts - tags/categories being the main thing I can think of at the moment. If you don’t need the built in handling of those you can do a lot with just using either pages or collections and then you don’t have to use the date in the file name.