Skip to main content

Pagination

What you're building: a way through a listing that is longer than one page — a load-more button, numbered pages, or infinite scroll.

Pagination is a property of a browse listing. Search does not paginate; it re-queries.

What you need

  • Applies toThe browse wrapper

    Which style to use: load-more, numbered, or infinite.

  • Applies toThe browse wrapper

    How many results per page.

Pick a style

ValueBehaviourControls you add
load-moreAppends the next page on clickA button marked wf-algolia-element="load-more"
numberedPage links, one per pagePrev, next and page-number elements
infiniteLoads as the visitor scrollsNone — the script inserts a sentinel

Set the style on the browse wrapper:

<section
wf-algolia-element="browse"
wf-algolia-index="products"
wf-algolia-pagination="load-more"
wf-algolia-per-page="12"
></section>

Load more

Add a button inside the wrapper with . The script hides it when there are no more pages, so design the visible state and let it disappear on its own.

Numbered pages

Numbered pagination is assembled from separate controls, each with its own role:

  • — previous page
  • — next page
  • — a single page link, cloned per page
  • — "page 2 of 9"

The page-number element is a template: design one, and the script clones it. Use to cap how many appear at once, so 200 pages do not produce 200 links.

Generated page links carry the class wf-algolia-page-num, and the current page gets the active class from data-activeclass.

Infinite scroll

Set wf-algolia-pagination="infinite" and add nothing else. The script places an invisible sentinel after the results and loads the next page when it scrolls into view.

Infinite scroll strands your footer

Anything below the listing becomes unreachable while pages keep loading. If the page has a footer people need, prefer load-more, which puts the visitor in control.

Scroll position

offsets where the page scrolls to when a new page loads. Set it to the height of a sticky header so the first new row is not hidden behind it.

Troubleshooting

SymptomCauseFix
The button does nothingIt sits outside the browse wrapperMove it inside
The button never disappearsThe style is not load-moreSet wf-algolia-pagination="load-more"
Page numbers do not renderNo element marked page-number to cloneAdd one
Infinite scroll fires once, then stopsThe next page failed — look for infinite-scroll loader rejected:Check the network tab
Every page shows the same resultswf-algolia-per-page exceeds the totalNothing to fix — there is only one page