master
master

Reputation: 266

Comma Separate Jekyll Posts

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

Answers (1)

David Jacquel
David Jacquel

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

Related Questions