Following the Jekyll Collections documentation , I wrote the following code in _config.yml
_config.yml
collections:
- popular_posts
So, when I print {{site.collections}}, the output is "popular_posts".
I also created the _popular_posts folder at the same level as the _posts. _popular_posts contains two .md files with some YAML controls, like a message.
However, if I print {{site.popular_posts}} or {{site.collections.popular_posts}}, there is no way out.
How can I Jekyll recognize .md files in this directory so that the following code works?
{% for popular_post in site.popular_posts %}
<a href="{{ popular_post.link }}">
<h1>{{ popular_post.title }}</h1>
<img class="pop-img" src="{{ popular_post.image_url }}">
</a>
<span id="pop-order"><span class="pop-current-popular_post-number">{{ popular_post.number }}</span>/5</span>
{% endfor %}
source
share