I had a bizarre and large draft here about how to interpret the documentation page concerning collections that I’ve been feeding the last four days… but that was deleted and I’ll try to limit this topic to the problem I’m facing: collections not working as expected (after reading - again and again - the documentation).
Desired result.
1 - A directory to the custom collections
2 - each collection’s directory should start with an _
(underscore)
3 - loop through and list the files of a collection in a page of another collection
1 - Added the following to _config.yml
:
collections:
collections_dir: _collections
2 - Somehow Jekyll wouldn’t build anything inside a directory prefixed with an underscore, at least until they were “included” as following:
include: ['_collections', '_pages', '_projects']
Where
_collections
: the directory to keep collections organized.
_pages
: the place to static general pages (like “about”, “contact”, listing categories etc).
_projects
: a collection with pages that just don’t match the general purpose of _pages
.
3 - I cannot get a list of the files (title and url) inside _projects
. All pages exists. In the _config.yml
, the permalink is set as:
permalink: :slug/
And all pages have something like this in their front-matter:
permalink: /manually-added-slug/
All pages can be acceded as http://localhost:4000/manually-added-slug/. This was the only way I founded to solve the permalink issue.
Basically, inside _collections/_pages/projects.md
, I’m trying to get something like this to work:
<ul>
{% for project in site.projects %}
<li>
<a href={{ project.path }}">- {{ project.name }}<a/>
</li>
{% endfor %}
</ul>
But keeping in mind that that is just an example… since many different things were tried there without success.
That’s with Jekyll 3.6.0 (but not declared in the Gemfile
), in Archlinux with Bundler version 1.15.4.
And just for the sake of… well… here is the gem file content:
source "https://rubygems.org"
gemspec
Thanks in advance for any given direction.