Skip to content

Instantly share code, notes, and snippets.

View KajKandler's full-sized avatar

Kaj Kandler KajKandler

View GitHub Profile
@KajKandler
KajKandler / README.md
Last active March 16, 2023 09:13
Wordpress (Astra theme) Archive pagination with all pages

Context

Wordpress with Astra theme, if you look at your theme, you may find a similar pattern and can adopt the solution.

Problem

Search engines like to discover pages via links, not just by sitemap. Category pages seem the ideal place to link to all pages.

In a blog with categories where some are rather large (= produce 5+ pages in an archive).

Wordpress, by default creates pagination links for 'previous', 'next' and if the current page number is cp, it creates links for cp - 2, cp - 1, ..., cp + 1, cp + 2. where 'previous' and 'next' are identical. For example