As suggested here, I want to use all my collections inside a subdirectory. I wanted to test this feature by putting this inside my _config.yml file:
collections:
collections_dir: mycollections
output: true
permalink: /:name
then I have mycollections
subdirectory as follows:
mycollections
...._book
........sample.md
However this file isnβt rendered in my jekyll.
What does the rest of your collection configuration look like? What you have above isnβt enough.
My understanding is all collections_dir
is allowing you to do is to place all your collections in a subfolder. So instead of:
my-project/
βββ _collection1/
β βββ some-file.md
β βββ another-file.md
βββ _collection2/
β βββ 2-some-file.md
β βββ 2-another-file.md
βββ _collection3/
β βββ 3-some-file.md
β βββ 3-another-file.md
You can clean things up with:
my-project/
βββ mycollections/
β βββ _collection1/
β β βββ some-file.md
β β βββ another-file.md
β βββ _collection2/
β β βββ 2-some-file.md
β β βββ 2-another-file.md
β βββ _collection3/
β β βββ 3-some-file.md
β β βββ 3-another-file.md
That said you still need to configure each collection as you normally would by setting each to output: true
and whatever permalinks you want. What you have above looks to be trying to apply a default config to all collections, which I donβt think Jekyll currently supports.
collections:
collections_dir: mycollections
collection1:
output: true
permalink: /:name
collection2:
output: true
permalink: /:name
collection3:
output: true
permalink: /:name
Ok so I changed my _config.yml to the following
collections:
collections_dir: mycollections
book:
output: true
permalink: /:name
but still my collections arenβt rendered. The interesting part is that if I remove _
from _book
, the markdown files are treated normally like a page. So I think the collections_dir
isnβt configured properly yet?
Have you already used this feature successfully? If not I think maybe there is a bug out there.
Nope. Havenβt used collections_dir
yet. Seeing how itβs not officially released wouldnβt surprise me if thereβs issues with it.
Your best bet is to file a ticket on jekyll/jekyll.
1 Like
I think thereβs an error in the official docsβ¦ from the souce code it looks like collections_dir
is a top-level key instead of being nested within collections
objectβ¦
So, if your Gemfile
is pointed towards the jekyll repo master
, then change your config file to following and try againβ¦
collections_dir: mycollections
collections:
collection1:
output: true
permalink: /:name
collection2:
output: true
permalink: /:name
collection3:
output: true
permalink: /:name
2 Likes
Yes. Thank you very much for your help.