# \[SOLVED\] Composite stream by looping over collections

**URL:** <https://talk.jekyllrb.com/t/solved-composite-stream-by-looping-over-collections/2926>\
**Category:** Help\
**Created:** [May 22, 2019, 4:56am UTC](https://talk.jekyllrb.com/t/solved-composite-stream-by-looping-over-collections/2926 "2019-05-22T04:56:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![leecalvink](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/leecalvink/32/1689_2.png) [@leecalvink](https://talk.jekyllrb.com/u/leecalvink)\
**Post date:** [May 22, 2019, 4:56am UTC](https://talk.jekyllrb.com/t/solved-composite-stream-by-looping-over-collections/2926/1 "2019-05-22T04:56:20Z")

</div>

Hi all.

I want to turn my home page into a composite stream, full posts of every type (so normal posts, but also other “posts” from collections as well). However there are a few condition I’m looking to fulfill.

One of said conditions being I don’t want to output every single post on one page, obviously there will be a "limit: " filter in one of the liquid tags, but I’m not sure which tag that would be. There will be pagination to access the rest (but perhaps using the limit filter is unnecessary with pagination involved?).

I also want to group and sort all output by the post/document date in reverse chronological order.

Lastly, and this is what is causing most of my grief, is I wish to do all this but skipping certain collections (a folder/collection of webmentions for instance).

I’ve been banging my head against my desk the last little while trying to figure this out. Help would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![mmistakes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mmistakes/32/2169_2.png) [@mmistakes](https://talk.jekyllrb.com/u/mmistakes)\
**Post date:** [May 22, 2019, 2:18pm UTC](https://talk.jekyllrb.com/t/solved-composite-stream-by-looping-over-collections/2926/2 "2019-05-22T14:18:21Z")

</div>

If you’re looping over posts without pagination you’d apply the `limit` filter to your for loop… e.g. `{% for posts in site.posts | limit: 10 %}`

Though since you’re paginating, that will handle the limits.  
The default (and deprecated Jekyll pagination plugin) won’t get you very far. Take a look at jekyll-paginate-v2 as it does a lot it not all of what you want.

> **[sverrirs/jekyll-paginate-v2](https://github.com/sverrirs/jekyll-paginate-v2)**
>
> Pagination Generator for Jekyll 3 (enhanced replacement for the old built-in jekyll-paginate gem) ⛺ - sverrirs/jekyll-paginate-v2

---

<div class="post-metadata">

**Author:** ![leecalvink](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/leecalvink/32/1689_2.png) [@leecalvink](https://talk.jekyllrb.com/u/leecalvink)\
**Post date:** [May 22, 2019, 11:13pm UTC](https://talk.jekyllrb.com/t/solved-composite-stream-by-looping-over-collections/2926/3 "2019-05-22T23:13:45Z")

</div>

Thanks, I guess I should set that up first.

The bigger issue I think is how I could theoretically group posts and certain collections together and sort the output by their date/time? I can imagine how to do a separate stream or section for each, but I would like it (if possible) to output them intermingled chronologically.

---

<div class="post-metadata">

**Author:** ![mmistakes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mmistakes/32/2169_2.png) [@mmistakes](https://talk.jekyllrb.com/u/mmistakes)\
**Post date:** [May 22, 2019, 11:26pm UTC](https://talk.jekyllrb.com/t/solved-composite-stream-by-looping-over-collections/2926/4 "2019-05-22T23:26:22Z")

</div>

Check the plugin docs. It does a lot.

> <https://github.com/sverrirs/jekyll-paginate-v2/blob/master/README-GENERATOR.md>

---

<div class="post-metadata">

**Author:** ![leecalvink](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/leecalvink/32/1689_2.png) [@leecalvink](https://talk.jekyllrb.com/u/leecalvink)\
**Post date:** [May 23, 2019, 3:13am UTC](https://talk.jekyllrb.com/t/solved-composite-stream-by-looping-over-collections/2926/5 "2019-05-23T03:13:45Z")

</div>

Holy shazbot. Ok, I’m impressed, that looks like it will do it.
