# Multiple \_posts directories for different collections? - SOLVED

**URL:** <https://talk.jekyllrb.com/t/multiple-posts-directories-for-different-collections-solved/9225>\
**Category:** Help\
**Created:** [May 31, 2024, 10:27pm UTC](https://talk.jekyllrb.com/t/multiple-posts-directories-for-different-collections-solved/9225 "2024-05-31T22:27:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![philiprhoades](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/philiprhoades/32/1755_2.png) [@philiprhoades](https://talk.jekyllrb.com/u/philiprhoades)\
**Post date:** [May 31, 2024, 10:27pm UTC](https://talk.jekyllrb.com/t/multiple-posts-directories-for-different-collections-solved/9225/1 "2024-05-31T22:27:43Z")

</div>

People,

I found a comment via Googling that this is possible but I am stuck - the suggestion was to put the new \_posts under a new dir eg “articles”. I have:

- created the the new dirs
- put an item in “articles/\_posts”
- copied blog.html to articles.html and edited it appropriately

but I am having problems with the iteration - this doesn’t work:

```auto
{% for post in site.articles.posts %}
<div class="post-area">
  <a href="{{ post.url | prepend: site.baseurl }}" class="bold">{{ post.title }}</a>
  <p class="post-date">{{ post.date | date_to_long_string }}</p>
  <p>
    {{ post.content | strip_html | truncatewords: 50 }}
  </p>
</div>
{% endfor %}

```

I have tried variations of “{% for post in site.articles.posts %}” but can’t get it to work - I presume it is something simple?

Thanks,  
Phil.

---

<div class="post-metadata">

**Author:** ![philiprhoades](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/philiprhoades/32/1755_2.png) [@philiprhoades](https://talk.jekyllrb.com/u/philiprhoades)\
**Post date:** [June 1, 2024, 9:40am UTC](https://talk.jekyllrb.com/t/multiple-posts-directories-for-different-collections-solved/9225/2 "2024-06-01T09:40:30Z")

</div>

I worked it out finally - I needed to set up the collections block in \_config.yml . . doh!

---

<div class="post-metadata">

**Author:** ![olea](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/olea/32/5328_2.png) [@olea](https://talk.jekyllrb.com/u/olea)\
**Post date:** [June 4, 2024, 4:22pm UTC](https://talk.jekyllrb.com/t/multiple-posts-directories-for-different-collections-solved/9225/3 "2024-06-04T16:22:27Z")

</div>

Could you please share the conf you added into \_config.yml?

---

<div class="post-metadata">

**Author:** ![george-gca](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/george-gca/32/5301_2.png) [@george-gca](https://talk.jekyllrb.com/u/george-gca)\
**Post date:** [June 6, 2024, 5:02pm UTC](https://talk.jekyllrb.com/t/multiple-posts-directories-for-different-collections-solved/9225/4 "2024-06-06T17:02:11Z")

</div>

If you want for example to set a projects collection under `_projects/`, add this to your `_config.yml`:

```yml
collections:
  projects:
    output: true
    permalink: /projects/:path/

```

---

<div class="post-metadata">

**Author:** ![philiprhoades](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/philiprhoades/32/1755_2.png) [@philiprhoades](https://talk.jekyllrb.com/u/philiprhoades)\
**Post date:** [June 6, 2024, 10:59pm UTC](https://talk.jekyllrb.com/t/multiple-posts-directories-for-different-collections-solved/9225/5 "2024-06-06T22:59:07Z")

</div>

Sorry about the slow reply - yes, @george-gca is correct . .
