Add -default-view to choose timeline or grid as the site root
The view named by -default-view (timeline, the default, or grid) is published at the site root; the other is served under /timeline/ or /grid/. viewBase and pageURL derive every page path, pager link and the Timeline<->Grid cross-link from the single setting, and Build removes both timeline/ and grid/ on each run so flipping the default never leaves a stale root behind. Reimplemented on trunk (which has albums and the /manage feature) rather than cherry-picked, since the original was written against an earlier base. Credit for the edit/delete and default-view ideas goes to Santhosh Raju, now noted in a README Contributors section. - main.go: -default-view flag, validated (fatal on anything but timeline/grid) - module.nix: services.photogallery.defaultView enum option - templates: timeline/grid/day/album/albums cross-links use TimelineURL/GridURL - tests: timeline-root, grid-root, and switch-cleanup
This commit is contained in:
1 parent
a7f2afc3ad
commit
8fa1aa4cd4
13 files changed
+209
-56
No files matched your search
@@ -113,9 +113,9 @@ contain spaces (`"berlin trip"`), and its URL slug is derived with `sanitiseSlug
|
||||
- Gruvbox dark hard colour scheme
|
||||
- Crimson Pro (serif) for headings and captions — configurable via `-serif-family` / `-fonts-url`
|
||||
- Manjari for Malayalam text (bio line), via `-ml-family`
|
||||
- Two views of the same photos, both 3-column square grid → 2-column on mobile, both with infinite-scroll load-more. Page size is configurable via `-page-size` (default 60; NixOS `services.photogallery.pageSize`):
|
||||
- **Timeline is the site root** (`/`, `/page/2/`, …). Photos grouped by calendar day: one ISO date heading (`2026-06-14`) + count per day, then the square grid. `groupByDay` collapses the newest-first list into consecutive same-day runs; `chunkDayGroups` packs whole days into pages targeting `pageSize`, never splitting a day across a page boundary (so appended pages never duplicate a heading — the load-more JS relies on this).
|
||||
- **Grid** (`/grid/`, `/grid/page/2/`, …) is the flat square grid, linked from the profile header.
|
||||
- Two views of the same photos, both 3-column square grid → 2-column on mobile, both with infinite-scroll load-more. Page size is configurable via `-page-size` (default 60; NixOS `services.photogallery.pageSize`). Which view sits at the site root is chosen by `-default-view` (`timeline` or `grid`, default `timeline`; NixOS `services.photogallery.defaultView`): the chosen one owns `/` (`/`, `/page/2/`, …) and the other is published under `/<name>/`. `viewBase`/`pageURL` (`generator.go`) derive every page path, pager link and the Timeline↔Grid cross-links (`TimelineURL`/`GridURL` in the template data) from that one setting; `Build` removes both `timeline/` and `grid/` each run so a flipped default leaves no stale root behind.
|
||||
- **Timeline** (the default root): photos grouped by calendar day — one ISO date heading (`2026-06-14`) + count per day, then the square grid. `groupByDay` collapses the newest-first list into consecutive same-day runs; `chunkDayGroups` packs whole days into pages targeting `pageSize`, never splitting a day across a page boundary (so appended pages never duplicate a heading — the load-more JS relies on this).
|
||||
- **Grid** is the flat square grid. At `/grid/` by default, or at the root when `-default-view grid`.
|
||||
- Each timeline date heading links to a **single-day page** (`/day/<YYYY-MM-DD>/`) holding just that day's photos. `renderDayPages` writes one per `groupByDay` run; the ISO label doubles as the URL slug.
|
||||
- Single photo page with sidebar and newer/older navigation
|
||||
|
||||
|
||||
Reference in new issue
Block a user