Reputation: 1083
I blog with Jekyll. In my source/index.html
(I reconfigured the paths in _config.yml
) I have written:
{{ site.posts }}
But when I compile it it gives no results. I am sure that I have posts, they are compiled and work as supposed.
I don't know where to start troubleshooting, have anyone else had such problem?
Upvotes: 2
Views: 1375
Reputation: 6766
Verify the post time, that it occurs in the past, future posts are not added to the site.posts
.
Upvotes: 0
Reputation: 1187
In Jekyll posts need to be in the _posts
folder to be included in the {{ site.posts }}
variable.
There's a good chance that you may have simply omitted the underscore in your folder name.
Upvotes: 0
Reputation: 1739
site.post returns and array of liquified Jekyll::Post objects. You can check the number of posts by simply writing:
{{ site.posts.size }}
and you could iterate through them writing:
<ul>
{% for post in site.posts %}
<li class="post">
<h1><a href="{{ post.url }}">{{ post.title }}</a></h1>
</li>
{% endfor %}
</ul>
Upvotes: 1