Reputation: 266
I want to list all my posts within site.categories.projects
as a comma separated sentence. There's documentation for displaying {{ site.tags }}
as array_to_sentence_string
but how can I use the filter with a for
loop?
Upvotes: 0
Views: 610
Reputation: 52809
# empty array
{% assign postsTitlesArray = '' | split:':' %}
# pushing categorie posts title in our array
{% for post in site.categories.one %}
{% assign postsTitlesArray = postsTitlesArray | push: post.title %}
{% endfor %}
{{ postsTitlesArray | array_to_sentence_string }}
Upvotes: 1