# Layout Error When Using Pagination with Collections (jekyll-paginate-v2)

**URL:** <https://talk.jekyllrb.com/t/layout-error-when-using-pagination-with-collections-jekyll-paginate-v2/4484>\
**Category:** Help\
**Created:** [May 27, 2020, 7:49pm UTC](https://talk.jekyllrb.com/t/layout-error-when-using-pagination-with-collections-jekyll-paginate-v2/4484 "2020-05-27T19:49:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brad](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/brad/32/2543_2.png) [@brad](https://talk.jekyllrb.com/u/brad)\
**Post date:** [May 27, 2020, 7:49pm UTC](https://talk.jekyllrb.com/t/layout-error-when-using-pagination-with-collections-jekyll-paginate-v2/4484/1 "2020-05-27T19:49:47Z")

</div>

I’m trying to paginate a portfolio but I’m getting unexpected output.

In my \_config.yml, I’ve got the following:

```auto
collections:
  portfolio:
    output: true

defaults:
- scope:
    type: portfolio
  values:
    layout: portfolio
    permalink: /:title/

pagination:
  enabled: true
  per_page: 6
  permalink: '/page-:num/'
  title: ':title — Page :num'
  sort_reverse: true
  trail:
    before: 6
    after: 6

```

I have a page, `portfolio.html`, which has the following frontmatter:

```auto
---
layout: default
title: Portfolio
pagination:
  enabled: true
  collection: portfolio
  per_page: 9
---

```

That page is pulling the correct data from `_portfolio`, but it is using the `for` loop from `blog.html`. It doesn’t matter if I add a `for` loop in the body of `portfolio.html` or leave the body blank.

The pagination is working as expected, but the layout is wrong. Where have I gone wrong?

---

<div class="post-metadata">

**Author:** ![brad](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/brad/32/2543_2.png) [@brad](https://talk.jekyllrb.com/u/brad)\
**Post date:** [May 31, 2020, 8:43pm UTC](https://talk.jekyllrb.com/t/layout-error-when-using-pagination-with-collections-jekyll-paginate-v2/4484/2 "2020-05-31T20:43:28Z")

</div>

After some more testing I found if I delete `blog.html`, the `for` loop in `portfolio.html` works as expected.

If I enable autopages for collections it works as expected. However, as best as I can tell, this will restrict me to one `for` loop for all collections.

```auto
autopages:
  collections:
    enabled: true
    slugify:
      mode: raw
      cased: true
    layouts:
      - "portfolio-archive.html"
    title: ":coll Topic Archive" # :coll is replaced by the category name
    permalink: "/:coll/"

```

Is there anyway to get a `for` loop to work for collections without autopages?
