2

I have problem with the {% paginate%} tag.

Setting:

  • Craft CMS 3.0.18
  • Channel with 3 Entries -> handle "newsBlog"

{% paginate craft.entries.section('newsBlog') as pageInfo, pageEntries %}

When i open the second Entry in the News-Channel i get following values

  • pageInfo.total: 3
  • pageInfo.currentPage: 1 -> Why?
  • pageInfo.nextUrl: empty -> Why?
  • pageInfo.prevUrl: empty -> Why?

I did a lot of Craft 2 projects without pagination problems.

What did I do wrong? Thx for help!

5

You need to set a limit on your element query, so Craft knows how many entries you want per page:

{% paginate craft.entries.section('newsBlog').limit(1) as pageInfo, pageEntries %}

If you don't set a limit, {% paginate %} will return a single page with all entries, because the default value for limit in Craft 3 is null (in Craft 2, the default was 100).

|improve this answer|||||
  • thx for answer!! – thomas Aug 2 '18 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.