From e329cd4ad265ba692153aab7aad404c79a200d00 Mon Sep 17 00:00:00 2001 From: Mischa Date: Fri, 19 Jun 2026 15:52:46 +0200 Subject: [PATCH] =?UTF-8?q?docs:=20update=20trip-switching=20checklist=20?= =?UTF-8?q?=E2=80=94=20home.alias=20is=20now=20permanent=20/home?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01RB86BaJBG3eGiMdfhmHRrQ --- CLAUDE.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index fab90e4..f474466 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -27,6 +27,36 @@ The site is structured around Trip entities. Key facts: - Nav in `base.html.twig` derives all links from `config.site.active_trip` - Post form parent (`post-form.md` → `pageconfig.parent`) **must be kept in sync** with `active_trip` - GPX route files live as media on the trip page itself, served via leaflet-gpx CDN +- Manage GPX files (view/upload/delete) at `/gpx-manager` — requires admin login; filenames are auto-slugified on upload + +### GPX file management + +GPX files are stored as page media on the trip page (`user/pages/01.trips//`). They are picked up automatically by `map.html.twig` via `trip_page.media.all`. + +The GPX manager page (`user/pages/03.gpx-manager/`) provides a browser UI at `/gpx-manager`: +- **Auth:** enforced by Login plugin via `access.admin.login: true` in frontmatter — shows login form if not authenticated +- **Template:** `user/themes/intotheeast/templates/gpx-manager.html.twig` +- **API:** uses Grav API v1 with session cookie auth (`session_enabled: true` in `user/plugins/api/api.yaml`) + - List: `GET /api/v1/pages{route}/media` + - Upload: `POST /api/v1/pages{route}/media` (multipart) + - Delete: `DELETE /api/v1/pages{route}/media/{filename}` +- **Slugification:** filenames are slugified client-side before upload (spaces/special chars → hyphens, lowercase); the file is sliced to a plain `Blob` so the third argument to `FormData.append` is always used as the filename +- **Media type:** `.gpx` is registered in `user/config/media.yaml` so Grav serves and tracks these files + +To add GPX files without the browser UI, drop them directly into `user/pages/01.trips//` and run `make content-push`. + +### Switching to a new trip + +Two places hardcode the active trip slug. Grav's config and page frontmatter are static YAML — no variable substitution is possible, so these cannot read from `site.yaml` automatically. **Both must be updated together** when starting a new trip, or entries will be posted to the wrong folder. + +| File | Key | Example value | +|---|---|---| +| `user/config/site.yaml` | `active_trip` | `italy-2027` | +| `user/pages/02.post/post-form.md` | `pageconfig.parent` | `/trips/italy-2027/dailies` | + +Note: `system.yaml` `home.alias` is permanently set to `/home` (the real home page) and does **not** need to change when switching trips. + +After updating, also create the new trip's page tree under `user/pages/01.trips//` with the standard four subfolders. ### Environment