feat: datetime round-trip in page properties, shared news cards, shownFields per page type #159

Merged
dominik.polakovics merged 1 commit from afk/151 into main 2026-10-07 02:21:01 +02:00

Closes #151
Fixes the date round-trip reported in #133 (closed as a duplicate of #151).

Dates (#133)

  • fieldValue (internal/pageops/settings.go) reads datetime fields through content.DateRFC3339, the conversion the page tree and module entries already use. Every spelling in the issue's table now reaches the form as RFC3339. An untouched save stores a quoted RFC3339 string holding the same instant. An unreadable value falls back to the field's default, else empty.
  • Regression tests: TestReadSettingsDatetimeSpellings (7 spellings: read, save, and a check that the stored instant is unchanged) and TestReadSettingsDatetimeUnreadable. All of them failed before the fix.

News cards

  • partials/news-teasers.html now draws only the card list. Each caller draws its own wrapper: news/list.html, term.html, and the news-list shortcode, whose root still carries id="c-<uid>" and the data-ce-* markers and renders with no items or a stale section. "Latest news" now shows the same cards as the archive, image and categories included.
  • New allNewsLink bool param (Show "All news" link, default false). It adds an "All news →" link to the section URL, and only when the section resolves.
  • News bundle version: 3; the tests that pinned the version are updated.
  • Theme tests check that the cards are identical, that the root anchor renders with and without items, that the link renders only when on, and the bridge markers under hugo server.

shownFields

  • New optional page-type key, validated at load: an unknown name, a repeated name, or a required non-title field left out is a load error naming the file. Names match exactly, case included. title is always accepted and always shows.
  • With no key, every field shows except backendLayoutNextLevel on a type with children: [], so news-item shows only "Backend layout". [] shows only the title. A list shows the title plus exactly the listed fields, and the form keeps its usual order.
  • It filters settingsFields only. Hidden fields keep their stored front matter (including a link field's Target companion) through a save. /api/pagetypes fields, the create dialog, Create seeding and module columns, sorts and filters are not filtered; tests cover each of these.

Type label

  • PageSettings shows the type's label ("Type: News item") through pageTypeLabel, in the page module and on the module's Properties tab. A type without a sidecar shows its id.

Docs

  • scaffold/site/AGENTS.md: shownFields, how front-matter dates are written and read (datetime paragraph and "Editing content by hand"), the shared news cards and allNewsLink.
  • README.md: shownFields and the bundle version 3 examples.
  • internal/pagetype package doc: shownFields.

Verification

  • npm run build, tsc --noEmit and npm test pass: 65 files, 1821 tests.
  • go vet ./... and go test ./... pass, with Hugo extended 0.163.3 on PATH; the news theme tests ran, none skipped.
  • go build ./cmd/harness succeeds.
  • Not done: the manual browser check against harness serve.

🤖 Generated with Claude Code

Closes #151 Fixes the date round-trip reported in #133 (closed as a duplicate of #151). ## Dates (#133) - `fieldValue` (`internal/pageops/settings.go`) reads `datetime` fields through `content.DateRFC3339`, the conversion the page tree and module entries already use. Every spelling in the issue's table now reaches the form as RFC3339. An untouched save stores a quoted RFC3339 string holding the same instant. An unreadable value falls back to the field's default, else empty. - Regression tests: `TestReadSettingsDatetimeSpellings` (7 spellings: read, save, and a check that the stored instant is unchanged) and `TestReadSettingsDatetimeUnreadable`. All of them failed before the fix. ## News cards - `partials/news-teasers.html` now draws only the card list. Each caller draws its own wrapper: `news/list.html`, `term.html`, and the `news-list` shortcode, whose root still carries `id="c-<uid>"` and the `data-ce-*` markers and renders with no items or a stale section. "Latest news" now shows the same cards as the archive, image and categories included. - New `allNewsLink` bool param (`Show "All news" link`, default `false`). It adds an "All news →" link to the section URL, and only when the section resolves. - News bundle `version: 3`; the tests that pinned the version are updated. - Theme tests check that the cards are identical, that the root anchor renders with and without items, that the link renders only when on, and the bridge markers under `hugo server`. ## `shownFields` - New optional page-type key, validated at load: an unknown name, a repeated name, or a required non-title field left out is a load error naming the file. Names match exactly, case included. `title` is always accepted and always shows. - With no key, every field shows except `backendLayoutNextLevel` on a type with `children: []`, so `news-item` shows only "Backend layout". `[]` shows only the title. A list shows the title plus exactly the listed fields, and the form keeps its usual order. - It filters `settingsFields` only. Hidden fields keep their stored front matter (including a link field's `Target` companion) through a save. `/api/pagetypes` `fields`, the create dialog, `Create` seeding and module columns, sorts and filters are not filtered; tests cover each of these. ## Type label - `PageSettings` shows the type's label ("Type: News item") through `pageTypeLabel`, in the page module and on the module's Properties tab. A type without a sidecar shows its id. ## Docs - `scaffold/site/AGENTS.md`: `shownFields`, how front-matter dates are written and read (`datetime` paragraph and "Editing content by hand"), the shared news cards and `allNewsLink`. - `README.md`: `shownFields` and the bundle version 3 examples. - `internal/pagetype` package doc: `shownFields`. ## Verification - `npm run build`, `tsc --noEmit` and `npm test` pass: 65 files, 1821 tests. - `go vet ./...` and `go test ./...` pass, with Hugo extended 0.163.3 on PATH; the news theme tests ran, none skipped. - `go build ./cmd/harness` succeeds. - Not done: the manual browser check against `harness serve`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat: datetime round-trip in page properties, shared news cards, shownFields per page type
All checks were successful
ci / build-and-test (pull_request) Successful in 8m59s
ce1feb5dca
- Page properties read a datetime field through content.DateRFC3339, so a
  front-matter date in any spelling Hugo reads (unquoted TOML datetime/date,
  YAML date, space-separated, JSON date-only) reaches the form as RFC3339 and
  saves back as the same instant; an unreadable value falls back to the
  default, else empty (#133).
- The news-list element draws its cards through the shared news-teasers
  partial, so "Latest news" and the archive show identical cards; the partial
  draws only the list and each caller owns its wrapper. New allNewsLink bool
  param ends the element with an "All news →" link. News bundle version 3.
- New optional page-type key shownFields filters the properties form; by
  default a childless type no longer shows the sub-pages layout picker. Title
  always shows; unknown/repeated names and unlisted required fields are load
  errors. Hidden fields keep their stored values.
- Properties show the page type's label instead of its id.
- AGENTS.md, README and the pagetype package doc updated.

Closes #151

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Author
Owner

[autoland] verdict: pass

This was generated by AI while landing a PR.

PASS. Validated against #151 (and #133, which it fixes).

Signal relied on: Forgejo Actions ci / build-and-test is green (run 142). It covers the frontend build and tests, go vet, and go test ./... with Hugo extended 0.163.3 installed, so the news theme tests ran. Nothing was re-run locally. The head already contains main, so there is no conflict.

Checked:

  • Conventions: the title is Conventional Commits, and the body says Closes #151 and links #133.
  • Dates: fieldValue now sends datetime through content.DateRFC3339. An unreadable value falls back to the default, else empty. Seven spellings are tested end to end: read, untouched save, and the same instant on disk.
  • shownFields: settingsFields filters a freshly built slice, so schema.Fields is never aliased. SaveSettings validates and applies only the filtered fields, so hidden keys and link Target companions are untouched. Load errors cover unknown names, repeated names and required fields left out. /api/pagetypes fields, the create dialog and module columns, sorts and filters are not filtered, and each has a test.
  • News cards: the partial draws only the card list and each caller draws its own wrapper. The shortcode root keeps ce/attrs.html. allNewsLink uses the section page's .RelPermalink and renders only when the section resolves. Bundle version is 3.
  • Type label: PageSettings uses pageTypeLabel and falls back to the type id.
  • Docs: AGENTS.md and the README cover shownFields, how front-matter dates are written, the shared cards and allNewsLink, per CLAUDE.md.

Note (not blocking): the PR body says the manual browser check against harness serve from the issue's How-to-verify was not done. Unit, server, component and theme tests cover the behaviour.

[autoland] verdict: pass > *This was generated by AI while landing a PR.* **PASS.** Validated against #151 (and #133, which it fixes). **Signal relied on:** Forgejo Actions `ci / build-and-test` is green (run 142). It covers the frontend build and tests, `go vet`, and `go test ./...` with Hugo extended 0.163.3 installed, so the news theme tests ran. Nothing was re-run locally. The head already contains `main`, so there is no conflict. **Checked:** - Conventions: the title is Conventional Commits, and the body says `Closes #151` and links #133. - Dates: `fieldValue` now sends `datetime` through `content.DateRFC3339`. An unreadable value falls back to the default, else empty. Seven spellings are tested end to end: read, untouched save, and the same instant on disk. - `shownFields`: `settingsFields` filters a freshly built slice, so `schema.Fields` is never aliased. `SaveSettings` validates and applies only the filtered fields, so hidden keys and link `Target` companions are untouched. Load errors cover unknown names, repeated names and required fields left out. `/api/pagetypes` `fields`, the create dialog and module columns, sorts and filters are not filtered, and each has a test. - News cards: the partial draws only the card list and each caller draws its own wrapper. The shortcode root keeps `ce/attrs.html`. `allNewsLink` uses the section page's `.RelPermalink` and renders only when the section resolves. Bundle version is 3. - Type label: `PageSettings` uses `pageTypeLabel` and falls back to the type id. - Docs: AGENTS.md and the README cover `shownFields`, how front-matter dates are written, the shared cards and `allNewsLink`, per CLAUDE.md. **Note (not blocking):** the PR body says the manual browser check against `harness serve` from the issue's How-to-verify was not done. Unit, server, component and theme tests cover the behaviour.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Cloonar/deckle!159
No description provided.