Questions tagged [pagination]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
38
votes
3answers
9k views

How to link to previous/next entries in a section?

What would be the equivalent in Craft of ExpressionEngine's Next/Previous entry linking? I was looking at getNext() and getPrev() (and their aliases next and prev) (via the EntryModel docs), but when ...
17
votes
3answers
7k views

How do i setup ajax paging for entries

Im looking for a good way to setup paging for new items with a simple "load more" button at the bottom. I know i'd use something like {% if craft.request.isAjax %} on the listing template to not ...
14
votes
2answers
4k views

How to paginate search results?

What’s the best way to paginate search results? I was using {% set query = craft.request.getParam('q') %} and then {% paginate craft.entries.search(query).section('…').limit(…).order('…') as ...
6
votes
1answer
830 views

Paginate Grouped Entries

I am trying to paginate grouped entries as follows... {% set searchParam = craft.request.getParam('q') %} {% set groups = craft.entries({ search: searchParam })|group('section') %} {% for ...
5
votes
4answers
1k views

Back to paginated page

While I know the back button does this perfectly well, I was wondering if there was a good way to "return to" a paginated page using a previous request or something? Wanting to do this server-side ...
5
votes
1answer
370 views

How can I show next/previous paging that's limited by specific criteria?

I'm adding prev/next links to a detail page and can't get craft.entries to return the correct entries. Specifically, I need craft.entries to return entries in the "leadership" section where the ...
4
votes
1answer
515 views

Troubleshooting paginated content cached globally

Looks like caching paginated content globally forces any following pages (p2,p3, etc) to just echo the same content as the first page. Using a regular cache tag works as desired, but I don't want to ...
4
votes
1answer
852 views

Paginate an array with multiple filters

I'm looking to paginate and array with multiple filters. The current url would be: www.example.com/search?filter=shorts&type=leather&brand=sams Clicking on the next next link returns: www....
4
votes
1answer
675 views

Modify ElementCriteria and use it for paginate

First some context. I'm using Smart Map for Craft to display some location based events in a listing. My structure is as follows: Events channel Locations channel Each event can occur multiple times,...
4
votes
1answer
494 views

Paginate Entries With The Same Tag

On a single entries page I have the following code: <div class="article-pagination"> {% set params = {section: 'databytes', order: 'title'} %} {% set prevDatabyte = entry.getPrev(...
4
votes
1answer
987 views

Paginate Entries by Day

This is giving me a surprisingly hard time. Has anyone tried to paginate entries by date, in this case, specifically by day; i.e.: First page loads today's posts, next page loads yesterday's, then the ...
4
votes
1answer
946 views

What's the best way to paginate through entries from an entries field type?

I have an entries field type associated with a structure section page. This displays the entries on this page in a particular order. When you click an entry link ti will take you to a detailed page ...
3
votes
3answers
3k views

Any examples of numeric pagination?

I can find examples of prev/next style pagination but none of creating proper numeric-style pagination (eg. how Google do it). Does anyone have an example I could use?
3
votes
2answers
2k views

Using pagination on a page with url with query string data

I have an index page that filters entries based on url query strings, eg: site.com/inductees?county=123. I put together a very simple pagination setup with next/prev links. However, when I click "...
3
votes
1answer
869 views

Getting the last X number of pages in pagination

I am working on a pagination for some articles. I am using a for loop to get the 3 pages after and before the current page .getPrevUrls(3) and .getNextUrls(3) So far it looks like this, where 35 is ...
3
votes
3answers
685 views

Pagination with randomly ordered entries

I have a need to list a set of entries 9 at a time but with a random order. The pagination happens via Ajax, with each next set of 9 entries loaded onto the page when the user clicks the "See more" ...
3
votes
1answer
301 views

Use different template for paginated entries

Puzzle of the day: How does one load paginated entries on a different template? Let's say in my homepage I'm loading the latest 5 entries and I would like to have pagination links below, however I ...
3
votes
1answer
62 views

Including Zii in Craft CMS

I have a large dataset of active records (not Craft entries) that I'd like to display in the admin frontend. Yii comes with a widget called CGridView, found here: framework/zii/widgets/grid/CGridView....
3
votes
1answer
344 views

Using prevSiblingOf and nextSiblingOf

Super simple problem. I'm on a news item page (not a paginated overview page) and want to show a link to the next news item in the Channel; So I can't understand why this is outputting nothing at all: ...
3
votes
1answer
184 views

Pagination / Custom Routes (Based on Entry Existing)

I've created a custom route for my entries based on week like so: 'events/(?P<year>\d{4})/(?P<week>\d{2})' => 'events/_weekindex', I know i can group entries by week like this: {% ...
3
votes
1answer
916 views

Limit entry pagination to 6 pages?

I've been given a site and asked to prevent visitors from seeing the news archive beyond page 6. The navigation has already been done, but if the user manually enters example.com/news/p7 they'll see ...
3
votes
2answers
479 views

relate pagination to entry on page

I have managed to sort most Craft CMS questions out by reading the docs and feedback on StackExchange but am having issues with this one. I have a page with a list of entries down the right side and ...
3
votes
1answer
876 views

Search across Entries and Assets and paginate combined results

I need to search both entries and assets and paginate the combined result. I have tried: {% set entries = craft.entries.search(query|trim).order('score').status('pending, live').find() %} {% set ...
2
votes
2answers
1k views

Exclude category from channel entries (with pagination)

I'm trying to paginate a channel of entries but I also need to exclude any entries that relate to a specific category. This is what I have so far... {% set insightCategory = craft.categories({"slug":...
2
votes
1answer
844 views

Sensible way to have different number of entries on page one of pagination?

I have a blog where page one has a big "feature" thumbnail and after that each subsequent thumbnail is half the size. I want that to only happen on page one, which i have done using: {% if paginate....
2
votes
2answers
602 views

Pagination base URL - any way to have pagination links go to URLs other than current one?

TL;DR: Looking for something like paginate_base parameter in EE, but for Craft. My site's homepage has content in tabs for different sections (news, products, etc.) and in each tab I would like to ...
2
votes
1answer
428 views

{% paginate %} Tag issue, no prevUrl / nextUrl Data

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 ...
2
votes
1answer
840 views

Search Results Pagination with multiple form fields

I have a search form containing 1 text field and 2 checkbox groups. Text field is called: keywords and the checkbox groups are called: services[] and locations[]. The search works fine if I don't ...
2
votes
1answer
1k views

How do I create pagination links for my entry index page?

So I may be somewhat obtuse here, but I’m trying to discern what I might be doing wrong in this instance. I’m attempting to use a {% paginate %} tag inside my craft.entries loop to return a simple ...
2
votes
2answers
356 views

Paginating Merged Element Queries

I really want something like this to work but the merge function turns Elements into Arrays. I've managed to work around it other times but what's the best practice to combine two entry sets and then ...
2
votes
1answer
338 views

Check paginated currentPage before setting the paginate tag

This might sound counter-intuitive, but I'm trying to set a specific limit; if the currentPage is the first paginated entry. {% set limit = paginate.currentPage == 1 ? 5 : 8 %} {% paginate craft....
2
votes
1answer
630 views

Excluding a single Entry ID of an Entry Type from craft.entries

Any help here would be appreciated… I feel like this is really close. I have 4 entry types, all of which are shown in a blog index: Article Video Image Blurb The most recent entry of the Article ...
2
votes
1answer
755 views

Paginate entries when I do not have a criteria model?

I have to... merge results from multiple different criteria models use Supersort to order my entries in the desired sort order [...] ...and need to paginate them for my index page. As the paginate ...
2
votes
1answer
510 views

Using ajax with routes is it right?

So doing some entries loading via ajax from this question which I expanded on. https://craftcms.stackexchange.com/a/9868/3579 I'm curious about setting up a route for the actual ajax file since it ...
2
votes
2answers
2k views

Paginate An Array Of Entries

I have read through the docs and I am not sure if what I need to do is possible with array sets. I have filtered my entries using the following code" {% set allDatabytes = craft.entries.section('...
2
votes
2answers
110 views

Merge, shuffle, and paginate 😱

I'm trying to get a list of users from two different user groups. One user group (premium) must always show first. Whenever the page is loaded, however, the listing of users should show randomly (...
2
votes
1answer
469 views

Check which pagination page to display code outside of pagination loop

I have some Featured news entries which appear at the top of the rest of the news entries. How do I set this so they are only on page 1 (before any pagination pages)? {# Only show on page 1 of ...
2
votes
2answers
723 views

How do I get Pagination to Work?

I thought this would be easy. I cut and pasted code that works from the Mijingo Happy Lager tutorial site. But, I keep getting the template error below. My code... {% paginate craft.entries.section(...
2
votes
1answer
714 views

Eager-load and pagination

I'm currently working on a relation-heavy website with a colleague of mine and, for that reason, eager-loading stuff looks very appealing to us. We've succeeded in eager-loading pretty much everything ...
2
votes
1answer
205 views

Combing an If Statement with Pagination

I'm trying to pull all the entries in a category that have a multi-selection selected and then paginate it. If I just do the below, it works perfectly fine. {% set entriesRed = craft.entries....
2
votes
2answers
383 views

Reverse count with paginated entries?

I have this loop {% paginate craft.entries.section('sermons').limit('10') as pageInfo, entries %} {% for sermon in entries %} ... {{ loop.revindex }} ... {% ...
2
votes
1answer
272 views

Use paginate info in another block

I'm trying to get my head around the following issue. I have a site which uses a base layout template base.twig, on which 3 layout templates are build (using extends). One of them is main.twig. I ...
2
votes
1answer
3k views

If URL Contains x Then Do Y in Twig / Craft Template?

I've got a website that has a resource center, news center and blog where each of those sections has a high quantity of assets that can be filtered by topic / type / date, etc. Additionally, due to ...
2
votes
1answer
385 views

How to use paginate with a date filter?

Assuming that I’ve a total number of 10 entries in my section('exhibitions') where 8 of them have their entry.endingDate < now, I limit the display to 8 entries but the paginate shows a next button ...
2
votes
1answer
532 views

Graphql total results / pageinfo when searching with pagination

I'm trying to build something to search my data that is stored in Craft with graphql. To make pagination work I want to know how many results there are in total. I'm doing a query like this: query($...
2
votes
1answer
15 views

Paginate events without setting expiry date

Is there a way to paginate events entries without setting an expiry date for each entry? So I currently have: {% paginate craft.entries.section('eventsEntry').limit(3).orderBy('eventDate') as ...
2
votes
1answer
34 views

Paginate entries ordered by a custom date field

I'm trying to paginate a bunch of events based on their start date. The order part is working correctly, but each consecutive page just loads the exact same entries. My code: {% set events = craft....
2
votes
1answer
97 views

Manually passing page number to paginate tag

{% paginate %} tag takes current subpapage number from url address. Can this behaviour be bypassed and page number be passed directly into {% paginate %} tag?
2
votes
1answer
269 views

Cache not invalidating when using pagination with cache

Any idea why this code wouldn’t update/break the cache when new items are created? Think perhaps the combination of my code for pagination, cache and the ability to also break for pending entries isn'...
2
votes
1answer
3k views

filtering entries by category

I've got my news entries paginated and I have a featured entry on the first page so I'm wondering what the best approach would be to filter by category. Here is what my template looks like: {% ...