Following the instructions in the Jekyll documention http://jekyllrb.com/docs/collections/, I created a collection in my jekyll blog for developer related posts
collections:
developer:
output: true
On a jekyll page, I try to output a list of the posts like this
<ul class="posts">
{% for post in site.developer %}
<li>
<span class="post-date">{{ post.date | date: "%b %-d, %Y" }}</span>
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
<p>{{ post.excerpt }}</p>
</li>
{% endfor %}
</ul>
This works on my local machine. I can view one post from this collection at
http://localhost:4000/developer/2014-07-07-blah-blah.html
and a list of the developer posts is visible on the developer page at
http://localhost:4000/developer/
However, the list isn't visible on github pages and I can't access the post at the url. The blog otherwise works fine on github pages i.e. all the site.posts on the homepage are visible etc.
Note, I did push the files to github. I can see them in the repo.
My first guess would be that "GitHub Pages" is still using an out-dated version of Jekyll.
GitHub pages' Dependency versions page shows that Jekyll 1.5.1 is used.
But collections feature was introduced in Jekyll 2.0.0 by PR 2199, see Jekyll History page here.
If this is the case, then there is nothing you can do, unless you host your repository elsewhere, or push the compiled source to GitHub pages.
You don't need to use Collection to generate custom list for Posts or Pages.
In your front matter add:
---
...
flag: dev
---
Example for a page list with flag == dev
{% for page in pages %}
{% if page.flag == 'dev' %}
<li><a href="{{ site.baseurl }}{{ page.url }}">{{ page.title }}</a></li>
{% endif %}
{% endfor %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With