Reputation: 11060
The Jekyll Bootstrap project has a sample blog post in the directory _posts/core-samples/
.
I assume, posts (files) in sub directories are handled the same way as posts in the root directory. Is this correct?
If so, I will add a "stage" sub directory, exclude it, so I can park posts and publish them by moving them.
Upvotes: 16
Views: 9756
Reputation: 10691
As the different is only on post.path
so I would agree to your statement:
posts(files) in sub directores are handled the same way as posts in the root diretory
You can park your posts in the directory _posts/core-samples/
and publish them like this:
{% for post in site.posts %}
{% if post.path contains 'core-samples' %}
..your code
{% endif %}
{% endfor %}
As a working sample you may see how this code publish these parked posts in their section.
Upvotes: 8
Reputation: 27594
I ended up here because I wanted to create the following structure:
index.html
_animals
cats
my-cat.html
...
dogs
my-dog.html
...
I created that structure, then in _config.yml
:
collections:
animals:
output: true
permalink: /animal/:title.html
Finally, to get just the dogs in index.html
:
<div id='dogs'>
{% for a in site.animals %}
{% if a.path contains 'dogs' %}
<a href='{{ a.url }}'>{{ a.title }}</a>
{% endif %}
{% endfor %}
</div>
NB: that this approach requires that the directory containing all the records (_animals
in my example) can't be named _posts
, as the latter is a special name in Jekyll.
Upvotes: 6
Reputation: 31
Actually what that statement says is to put _posts folder inside a sub directory. And then that sub directory will be treated as category.
Upvotes: 2
Reputation: 11060
Accidentally found it in the post - yaml section:
Instead of placing posts inside of folders, you can specify one or more categories that the post belongs to. When the site is generated the post will act as though it had been set with these categories normally. Categories (plural key) can be specified as a YAML list or a space-separated string.
So sub directories == categories
Upvotes: 7