Skip to content
SprecherEast
Issue 787

documentation: Knowledge note for the site module, part 2: header, footer, forum link and redirects

Back to our plan
Done
documentationfrontendcmstoolingpriority: medium

Type

documentation

Summary

Write the second note on the site module: how the header navigation, the footer and the forum link get their links, when they refresh, and how the redirects editors set are followed without ever revealing a draft.

Problem

The header and footer read globals cached until an editor saves them, while the pages they link to change on their own schedule; redirects resolve their target as a visitor would. These timing and privacy rules are spread over cms, data, domain, use-cases and ui files.

What the generated reference already shows, so the note doesn't repeat it: header, opens in a new tab, footer, opens in a new tab and redirects, opens in a new tab list fields (up to six links, the forum address), access and hooks; navigation, opens in a new tab lists the kit pieces. Missing: how links resolve, what refreshes when, and the redirect rules.

Proposed fix

Write src/modules/site/navigation/README.md from the template. Owner's direction for every note (2026-11-06, Claude session, recorded on #712 and #719): a note explains the behavior and logic of its content types and code (what shows, where, when, who publishes or changes it, and the special rules), never a list of fields; and every link between fields is stated near the top, so no agent has to work it out from the code.

Links between fields the note states up front (each one checked in the code first):

  • Each nav item is the shared link field (a page or post, or a custom URL), resolved to an href by resolveLink (src/platform/payload/link.ts, resolveLink.ts); linked pages are populated whether or not they're published (data/globals.ts, #251).
  • The footer global holds the forum address; the footer and each post page link to it, both hidden without an https address (domain/forum.ts, use-cases/getForumUrl.ts, ui/ForumPrompt.tsx).
  • A redirect's target is a page or post reference or a custom URL; a reference is looked up as a visitor (data/documents.ts, use-cases/getRedirectTarget.ts).
  • Each cache tag is named once and used by both the cached read and the hook that expires it (domain/cacheTags.ts, cms/revalidateGlobal.ts, cms/revalidateRedirects.ts).
  • The account links come in as slots from the layout, which composes the accounts module (ui/SiteHeader.tsx, decision 0008).

Behaviors and rules the note must cover (each with the file or test named):

  • Saving the header or footer expires its tag; nothing refreshes them when a linked page is published (cms/revalidateGlobal.ts, #251).
  • The nav leaves out a Contact item (the header has its own button) and marks the current section (domain/nav.ts).
  • The mobile menu closes on a new page and when the screen grows past the desktop breakpoint (ui/SiteHeaderBar.client.tsx).
  • Redirects: saving one expires the redirects tag; a redirect whose target isn't published answers null, so it never reveals a draft; with none, 404 unless the page exists (use-cases/getRedirectTarget.ts, ui/PayloadRedirects.tsx); targets are cached for 10 minutes with no tag refresh yet (data/documents.ts).
  • The redirects plugin is set up in src/payload.config.ts (pages and posts, admin-only access).
  • The logo link's tap size (ui/Logo.tsx, #741).

Tests to name under "Rules and the tests that protect them": cms/navGlobal.test.ts, cms/linkGroup.test.ts, cms/revalidateRedirects.test.ts, data/globals.test.ts, domain/forum.test.ts, domain/nav.test.ts, use-cases/getRedirectTarget.test.ts, ui/HeaderNav.client.test.tsx, ui/SiteHeaderBar.client.test.tsx, ui/SiteFooter.test.tsx, ui/ForumPrompt.test.tsx, ui/PayloadRedirects.test.tsx, ui/Logo.test.tsx, and src/redirects.test.ts.

Map entry: { "note": "src/modules/site/navigation/README.md", "paths": ["src/modules/site/cms/navGlobal.ts", "src/modules/site/cms/linkGroup.ts", "src/modules/site/cms/NavItemRowLabel.client.tsx", "src/modules/site/cms/revalidateGlobal.ts", "src/modules/site/cms/revalidateRedirects.ts", "src/modules/site/data/globals.ts", "src/modules/site/data/redirects.ts", "src/modules/site/data/documents.ts", "src/modules/site/domain/nav.ts", "src/modules/site/domain/forum.ts", "src/modules/site/domain/cacheTags.ts", "src/modules/site/ui/SiteHeader.tsx", "src/modules/site/ui/SiteHeaderBar.client.tsx", "src/modules/site/ui/HeaderNav.client.tsx", "src/modules/site/ui/SiteFooter.tsx", "src/modules/site/ui/Logo.tsx", "src/modules/site/ui/ForumPrompt.tsx", "src/modules/site/ui/PayloadRedirects.tsx", "src/modules/site/use-cases/getForumUrl.ts", "src/modules/site/use-cases/getRedirectTarget.ts"] }

The second site note lives in a subfolder (decision 0019, section 3). src/modules/site/navigation/ holds only the note; the name says what it covers. The map lists files so a page-builder change doesn't ask for this note; check, with #786, that every file of src/modules/site/ is in exactly one entry.

Acceptance criteria

  • Not done: src/modules/site/navigation/README.md follows docs/knowledge/note-template.md and is at most 80 lines.
  • Not done: Between this entry and #786's, every file of src/modules/site/ is covered by exactly one note's paths.
  • Not done: It explains behavior and logic, not fields: no field lists, props tables or route lists. It links the generated pages named above for those.
  • Not done: Right after its opening sentences, a short list states every link between fields named above (relationships, values copied or derived, mapper inputs and the props they become, hooks that copy a value), each with its file.
  • Not done: Every behavior listed above is covered or, if the code turns out different, the note says what the code does and this issue gets a comment saying what changed.
  • Not done: Every statement names the file or test it comes from, checked against the code at the branch's base.
  • Not done: docs/knowledge/index.md gets one short line for the note (a few words after the link). It stays within the budget check.
  • Not done: docs/knowledge/map.json gets the entry above.
  • Not done: npm run agent-context -- --write has been run and its generated rule committed, and npm run agent-context passes. If the budget check fails, this issue is not done; trimming other always-loaded files is not part of this issue.
  • Not done: Known contradictions: none of #279, #158, #366 or #531 applies. #617 (move the header off generated types) is open: the note's Known gaps names it.
  • Not done: No code changes. A bug or gap found in the code goes under the note's "Known gaps" and is filed as its own issue (labeled scope-creep, linked here).
  • Not done: Prettier, Knowledge sync, PR Policy and Agent context pass.

Files likely touched

  • src/modules/site/navigation/README.md
  • docs/knowledge/index.md (one line)
  • docs/knowledge/map.json (one entry)
  • .claude/rules/generated/src--modules--site--navigation--README.md

Must not touch

  • Code under src/ (the note itself excepted): this issue documents behavior and changes none.
  • Other notes, their generated rules, and the files the other note issues under #712 list.
  • docs/knowledge/note-template.md and the session-start set (CLAUDE.md, AGENTS.md, docs/guidelines/guard-rails.md).
  • docs/architecture/data-model.md, docs/ui/data-types.md, docs/ui/component-set-modules.md: read them and fold this area's facts into the note (decision 0019, section 7); report any drift in them in a comment on #712 instead of editing them, since every note issue reads them.
  • src/modules/README.md, src/platform/README.md, docs/project.md (#725 owns them).
  • The page and page-builder files of src/modules/site/ and src/modules/site/README.md (#786).

Open questions

  • Session-start room. The index line needs room at session start, which #799 makes. This issue is blocked by #799 and is not Ready until it lands; the line then stays within the budget check.
  • Dead code first. #728 (the audit, waiting for the owner's keep-or-drop marks) removes unused or unwanted code before a note describes it. This issue is marked blocked by #728; it can start once #728 has settled this area, even if other areas are still open there.
  • Size: not set; a cloud session can't read the board. Suggested: M.

Area

tooling, cms, frontend

Priority

medium


Generated by Claude Code, opens in a new tab

See it on GitHub, opens in a new tab