Skip to content

Releases: michaeldroste/previous-next-random-buttons

CMS Prev Next 2.18

Choose a tag to compare

@michaeldroste michaeldroste released this 25 Aug 15:27
da9be08

Previous / Next / Random navigation for RapidWeaver Elements CMS items. Drop it
into a CMS Item page and it finds the neighbouring post on its own — no hidden
collection, no page picker, no list to maintain.

Free, MIT licensed. No libraries, no CDN, no third-party services.

Install

Download CMS-Prev-Next-v2.18.zip below, then Elements → Settings → Addons →
Add Pack
. The component appears in the CMS group. The "Source code"
archives contain only the README — take the pack zip.

Two requirements

Both are how the Elements CMS works, not choices this component makes.

  • It has to sit inside a CMS Item, in the Before or After drop zone. Outside
    that context there is no current item to have neighbours.
  • The page has to be published with a .php extension, like every CMS page.
    The neighbours are worked out when the page is requested, so the component is
    server-side. If the page is not .php it renders nothing at all, deliberately —
    it will never print PHP source onto your page.

What you get

Three buttons — Previous, Random, Next — sharing one set of styling
controls across three styles (Buttons, Links or Cards), in your theme's brand and
accent colours. Item titles, feature images, labels and icons are each switchable.

Random is chosen by the server on every request, so it works with scripting off
and in a text browser. A small script improves the second press: without it,
Back then Random leads straight back to the item you just left, because the page
comes out of the back/forward cache with the address the server wrote the first
time. While it's there it skips the handful of items already seen this visit.

About the version number

The version jumps from 1 to 2 here and nothing in the component changed because
of that. It is a numbering change only — the build number carries straight on
from 17, so no build went missing between 1.17 and 2.18.

Fixed in this build

  • One server-side fallback disagreed with its own switch: Show Item Titles
    read as on in the one circumstance the fallback is consulted at all, which is
    a settings file that failed to arrive. Nothing to change by hand.
  • Build 17 corrected the Random button's skip-what-you-have-already-seen list,
    which was comparing two spellings of the same address and so quietly never
    skipped anything on a site with Pretty URLs off. The button itself always worked.

If you already have a navigation placed

Elements writes every default into your project the moment a component is added,
so a changed default never reaches one already on a page. Two things to do by hand:

  • The Random button will appear on navigations you already have placed. It is
    a new setting, so there is no stored value to protect it. If you do not want
    it, switch Buttons → Show Random Button off on each one before you publish.
  • Set Layout → Horizontal Gap to 10. Its default dropped from 25 to make
    room for the third button, and that change follows the usual rule, so it will
    not reach a placed instance. At 25 the three buttons spread much too wide.

Limits worth knowing

  • Hover colours are desktop-only on an Elements 3.x site. Tailwind 4 compiles
    every hover: utility inside @media (hover: hover), so the hover colours and
    lift do not fire on touch. The buttons are ordinary links and behave
    identically. Site-wide legacy switch: Project Settings → Advanced.
  • It reads the collection folder on every request. Nothing at tens or
    hundreds of items; at several thousand you would want caching this does not do.
  • Random needs the page to reach the server. If a CDN serves a cached copy of
    your post pages, every visitor gets whichever item was random when that copy was
    made. Doesn't arise on ordinary shared hosting.

Requires RapidWeaver Elements 3.0.9 or later. Full detail, including the settings
history for older builds, is in the README inside the pack.