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:
puttaalu committed 2026-10-18 22:06:46 +02:00
1 parent a7f2afc3ad
commit 8fa1aa4cd4
13 files changed
+209 -56

No files matched your search

+7
View File
@@ -2,6 +2,13 @@
A minimal static photo gallery with an Atom feed and an upload API.
## Contributors
- **[Santhosh Raju](https://git.planet-express.in/fox)** — originated the ideas for the edit/delete ("manage")
capability and the configurable default view (`-default-view`, timeline or
grid as the site root). Both landed here as independent implementations
building on that work.
## How it works
1. Drop `photo.jpg` + `photo.toml` into the content directory (or upload via the web UI at `/upload`).