Resources: sort by newest added and choose how many per page

Merged
LU
1d ago
+226-49

The resources directory has 1,473 resources but showed them in one fixed A to Z order, 24 per page. There was no way to see what was added recently or to change how much a page shows. Now two small menus sit beside the search box, in its style: one sorts by Title A–Z or Newest added, the other shows 12, 24 or 48 per page. On a phone they sit side by side below the search box. The results line gives the range: "Showing 1–24 of 1,473 resources, A to Z". Each menu has a label for screen readers but no visible label, because its options say what it does.

  • "Newest added" uses the form's timestamp field, not lastmod, which a script carries forward. 1,177 resources have a real date. 296 carry a placeholder 01/01/2020, which counts as undated and sorts last.
  • Sort, page size and page go in the address with the filters (?sort=newest&per=48&page=2), so links and Back work. The default view keeps its /resources/page/N/ addresses.
  • Filtered and re-sorted views use numbered page links at the top and bottom instead of "Show more", and focus moves to the first result on the new page.
  • scripts/rebrand/check_design.py now tests the page links, Sort and Per page instead of the removed "Show more" button.

Decisions to review

  • Page sizes: 12, 24 and 48, so the existing 24-per-page URLs stay valid.
  • Phone default: phones default to 12 per page.

Based on #1118. Checks: SEO and source rules pass. axe and the design check flag nothing on the resources pages. Playwright tests at 1440 and 390 px pass: sort order, per page, filters combined with sort, Back and Forward, and no overflow.

Desktop, search and first results (before above, after below)

Resources desktop: before and after

Phone, first screen

Resources phone: before and after

Created with Claude Opus 5.5 in Claude Code.

šŸ¤– Generated with Claude Code


Summary by cubic

Adds Sort and Per page controls to the resources directory, so visitors can see the newest additions and choose 12, 24 or 48 cards per page instead of the fixed A to Z, 24-per-page list. The two controls sit as quiet menus beside the search box, and below it on phones; the search keeps at least 18em, so with enlarged text or a narrow column the menus wrap below it.

  • Newest added sorts by the form's timestamp; resources without a real date (296 carry the 01/01/2020 placeholder) sort last.
  • The results line now shows the range and order, e.g. "Showing 1–24 of 1,473 resources, A to Z".
  • Sort, page size and page number go in the address with the filters; the page size is kept so phone-created links show the same view elsewhere, and unrelated parameters (such as campaign tags) survive.
  • Filtered and re-sorted views paginate with numbered page links at the top and bottom, replacing "Show more".
  • Phones default to 12 per page; wider screens keep 24.