I can not find a solution. I have three categories: tuts, news, code.
The latest publication is divided into categories. But I want to show the latest and newest news post. I tried the following, but obviously it shows nothing, because if I restrict the loop to the first element, which is the tuts element, the loop stops.
{% for post in site.posts limit:1 %}
{% if post.categories contains 'news' %}
<a href="{{ site.url }}/news/">NEWS</a></strong> › <a href="{{ site.url }}{{ post.url }}">{{ post.title }}</a>
{% endif %}
{% endfor %}
How to show the first publication from a special category? Can I scroll directly to a selected category? If so, what is the correct syntax?
{% for post in site.posts.categories.news limit:1 %}
<a href="{{ site.url }}/news/">NEWS</a></strong> › <a href="{{ site.url }}{{ post.url }}">{{ post.title }}</a>
{% endfor %}
Phlow source
share