← all skills

dg-random-note

A “surprise me” route for your garden.

L1 · low risk v1.0 MIT digital-garden eleventy navigation
dg-random-note example screenshot dg-random-note example screenshot

Adds a /random route to your Digital Garden. Visiting /random/ redirects the visitor to a randomly chosen published note. The whole feature is one file — no build scripts, no dependencies, no plugin-core edits.

Destination, not button. This installs the route only. If you also want a floating shuffle button, that lives in dg-floating-tray — its “random” action already links to /random. This is what that button points at.

How it works

The Eleventy template does two things. At build time, a Nunjucks loop over collections.note inlines a JS array of every published note URL into the page. At runtime, a two-line script picks one at random and calls location.replace() — so /random/ stays out of the back-button history and “back” returns you where you came from instead of re-rolling.

build → inline published note URLs into <script>
runtime → pick one at random → location.replace(url)
empty pool → redirect to FALLBACK_URL (default "/")

How to use it

Copy the skill folder into your agent's skills directory, then in your Digital Garden repo ask:

git clone https://github.com/palol/skills-zoo.git
cp -r skills-zoo/skills/dg-random-note ~/.claude/skills/

(or ~/.agents/skills/)

Use the dg-random-note skill to add a /random route to my digital garden that redirects to a random published note. Install the one page file, then build and walk me through verification.

What it touches

Why a root page, not a slot component. A route needs its own permalink, which a footer/header slot can't provide — so this lives at src/site/~random.njk instead of components/user/. Still upstream-safe: it's a brand-new file you own. One config knob: FALLBACK_URL.

What's in the box

Prerequisites

Scope is Digital Garden onlycollections.note and the dg-publish flag are DG-specific.

Browse the full source on GitHub →