# Combine posts from some but not all collections

**URL:** <https://talk.jekyllrb.com/t/combine-posts-from-some-but-not-all-collections/3810>\
**Category:** Uncategorized\
**Created:** [January 15, 2020, 9:00pm UTC](https://talk.jekyllrb.com/t/combine-posts-from-some-but-not-all-collections/3810 "2020-01-15T21:00:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Koos](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@Koos](https://talk.jekyllrb.com/u/Koos)\
**Post date:** [January 15, 2020, 9:00pm UTC](https://talk.jekyllrb.com/t/combine-posts-from-some-but-not-all-collections/3810/1 "2020-01-15T21:00:44Z")

</div>

I’m trying to create an array of pages from one or more (but not all) collections. Background, as you may guess from the code: I organize translations using collections and want to link to the translations that may or may not exist for each page. To do so, I want to create an array of all the pages that may be a translation, so that I can filter that array. This is what I came up with:

```auto
  {% assign page-translations = "" | split: "" %}
  {%- assign collections = site.collections | where_exp: "item", "item.label != 'posts' and item.label != page.collection" -%}
  {%- for collection in collections -%}
    {% assign page-translations = page-translations | concatenate collection %}
  {%- endfor -%}

```

This fails however, because Jekyll says “concat filter requires an array argument”. Apparently the collection isn’t an array. Of course I could create a template iterating through each collection, but by creating an array with the translations first, I can use that in several of my includes and avoid the need to do the filtering an additional two times.

I have a simple one liner solution already:

```auto
  {%- assign page-translations = site.documents | where: "translation-reference", page.translation-reference | where_exp: "item", "item.collection != page.collection" | sort: 'language' -%}

```

But I can imagine that becoming a performance issue, because it checks _all_ documents instead of just the collections that may contain a translation.

Any ideas of how to combine pages from multiple collections?

---

<div class="post-metadata">

**Author:** ![arnab](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/arnab/32/1238_2.png) [@arnab](https://talk.jekyllrb.com/u/arnab)\
**Post date:** [April 21, 2020, 3:27pm UTC](https://talk.jekyllrb.com/t/combine-posts-from-some-but-not-all-collections/3810/2 "2020-04-21T15:27:10Z")

</div>

Hi @Koos, did you find a way to do it? I am trying to do the same thing, to loop through multiple collections, but facing the concatenation problem.

---

<div class="post-metadata">

**Author:** ![Koos](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@Koos](https://talk.jekyllrb.com/u/Koos)\
**Post date:** [April 21, 2020, 7:24pm UTC](https://talk.jekyllrb.com/t/combine-posts-from-some-but-not-all-collections/3810/3 "2020-04-21T19:24:56Z")

</div>

I didn’t find another solution, but realized the problem isn’t huge in my case, because I don’t expect the site to have many pages. If I understand it correctly, collections are for pages only, so I’d have to set up a similar lookup for posts, probably using categories.
