Trail conditions widget

Three ways to show the code for a small widget. Colors, fonts and corners come from the Vanilla Breeze theme.

Line numbers, highlighted lines and focus mode

async function loadConditions(trailId) { const response = await fetch(`/api/trails/${trailId}/conditions`); if (!response.ok) { throw new Error(`Trail ${trailId} returned ${response.status}`); } return response.json(); } const report = await loadConditions('skyline-loop'); console.log(report.summary);

Several files as tabs, with a download button

<article id="conditions"> <h2>Skyline Loop</h2> <p><output name="summary">Loading</output></p> <p>Updated <time datetime="2026-06-14">June 14</time></p> </article> #conditions { padding: var(--size-m); border: var(--border-width-thin) solid var(--color-border); border-radius: var(--radius-m); } #conditions output { font-weight: 600; } { "trail": "skyline-loop", "summary": "Dry and clear, snow above 2100 m", "open": true, "updated": "2026-06-14" }

A diff

- const report = await loadConditions('skyline-loop'); + const trailId = new URLSearchParams(location.search).get('trail'); + const report = await loadConditions(trailId ?? 'skyline-loop'); console.log(report.summary);