Merge main (security-perf + SEO) into docs; finish English docs and agent guide

- Resolve conflicts in analytics, consent, content, i18n, mcp and stats,
  keeping the docs fixes and the new code behaviour, verified against src
- Translate the remaining 14 module pages, ipal-seo-check skill and script
- Integrate the security-perf and SEO agent-guide text: getRobots,
  isPathVisible, Search & AI (DNS verification first, meta fields optional),
  sitemap index/cache/503, consentMode basic/advanced, policyVersion,
  globalOverrides, revalidatePath / buildGlobalRevalidateHook, authAccess,
  firstUserAdmin, allowCollectionMismatch, unknown-IP rate limit; stale
  claims fixed across AGENT.md, skills, frontend, developer guide, vibe
- docsConsistency: pending list removed (all docs English); relative links
  now also check #anchors

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-22 17:59:52 +02:00
co-authored by Claude Opus 5.5
107 changed files with 5476 additions and 2541 deletions
+67 -43
View File
@@ -1,68 +1,92 @@
# Strona w budowie (narzędzie deweloperskie)
# Under construction (developer tool)
Tryb dla strony, która nie jest jeszcze gotowa: odwiedzający widzą tylko stronę główną i wybrane
podstrony (np. brief), a cała reszta jest zablokowana — bez zmian w kodzie, jednym przełącznikiem w panelu.
A mode for a site that is not ready yet: visitors see only the home page and selected
subpages (e.g. a brief), and everything else is blocked — no code changes, one switch in the admin panel.
## Panel
**Site Settings → Under construction** (zakładka jest, gdy włączony moduł `pages`):
**Site Settings → Under construction** (the tab is there when the `pages` module is on):
| Pole | Znaczenie |
| Field | Meaning |
|---|---|
| Site under construction | włącza tryb |
| Pages still available | strony, które dalej się otwierają; **strona główna jest dostępna zawsze** |
| Notice title / text / Close button label | treść popupu (per język); pusty przycisk → `×` |
| Site under construction | turns the mode on |
| Pages still available | pages that still open; **the home page is always available** |
| Notice title / text / Close button label | popup content (per language); empty button → `×` |
Pola w globalu SiteSettings: grupa `construction` → `enabled`, `allowedPages` (relacja do kolekcji
stron, hasMany), `title`, `message`, `buttonLabel` (lokalizowane).
Fields in the SiteSettings global: group `construction` → `enabled`, `allowedPages` (relationship to the pages
collection, hasMany), `title`, `message`, `buttonLabel` (localized).
Lista stron i teksty pokazują się dopiero po zaznaczeniu przełącznika. Wyłączenie trybu przywraca
normalne działanie strony.
The page list and texts show only after the switch is checked. Turning the mode off restores
normal site behaviour.
## Jak działa
## How it works
- **Adres spoza listy** (także nieistniejący) → przekierowanie na stronę główną w tym języku z
`?notice=construction` (`createPageRoute` z opcją `redirect`). Strony dozwolone liczone są w
**każdym języku** (`/pl/brief` i `/en/project-brief`), więc przełącznik języka działa.
- **Kliknięcie linku** do strony spoza listy → `<ConstructionNotice>` anuluje przejście (przed
`next/link`) i pokazuje popup. Linki zewnętrzne, kotwice na tej samej stronie, `target="_blank"`
i kliknięcia z modyfikatorem (Ctrl/⌘) działają normalnie.
- Po przekierowaniu popup otwiera się raz, a parametr znika z paska adresu.
- **Jedna reguła dla wszystkich odwiedzających** — strony zostają statyczne (ISR), bez sprawdzania
sesji. **Plugin nie rewaliduje stron po zapisie globala Site Settings** (hook rewalidacji działa
tylko na kolekcjach) — już wyrenderowane/zcache'owane strony pokazują stary stan, dopóki projekt
sam ich nie zrewaliduje (np. `revalidatePath` w `afterChange` globala) albo nie minie okres ISR.
- **Zakres blokady: tylko trasa stron** (`createPageRoute` → `Page`, wymaga przekazania `redirect`).
Nie są blokowane: wersje Markdown (`.md`), MCP, wyszukiwarka, sitemap, `llms.txt`, trasy wpisów
spoza `createPageRoute` ani API Payload — treść „ukrytych” stron dalej da się z nich odczytać.
- **An address not on the list** (also a non-existent one) → redirect to the home page in that language with
`?notice=construction` (`createPageRoute` with the `redirect` option). Allowed pages are counted in
**every language** (`/pl/brief` and `/en/project-brief`), so the language switcher works.
- **Clicking a link** to a page not on the list → `<ConstructionNotice>` cancels the navigation (before
`next/link`) and shows the popup. External links, anchors on the same page, `target="_blank"`
and modifier clicks (Ctrl/⌘) work normally.
- After the redirect the popup opens once, and the parameter disappears from the address bar.
- **Markdown and MCP** from `createContentHelpers` (`markdownRoute`, `mcpPOST`) hide the same pages:
`/md/…` → 404, `list_pages` / `search_content` do not show them, `get_page` → "No page found".
Your own `createSearchRoute` / `createMcpRoute` / `createMarkdownRoute` → pass
`isPathVisible` from `lib/content` (`createSearchRoute({ …, isPathVisible })`).
- **Sitemap and llms.txt** from `createContentHelpers` list only the pages still open (option
`underConstructionSeo`, default `true`; `false` lists everything). Hidden pages redirect to the home
notice, which crawlers would otherwise index.
- **The proxy does not check the mode** — that would need a database query on every request; the blocking
is done by routes that read content anyway (page, Markdown, MCP, search, sitemap, llms.txt).
## Wpięcie w projekcie
## Building blocks
```ts
import { isPathVisibleIn, pathOf } from '@intecion/ipal-kit'
isPathVisibleIn(await getConstructionMode(locale), '/pl/o-nas') // false when the mode hides the page
pathOf('https://acme.pl/pl/o-nas?x=1') // '/pl/o-nas' — path from a result URL
```
`isPathVisible(path, locale)` from `createContentHelpers` = the same with the mode read for you (type `PathVisibility`).
## Wiring in the project
```tsx
// app/(frontend)/[locale]/[[...slug]]/page.tsx — redirect włącza blokadę adresów
// app/(frontend)/[locale]/[[...slug]]/page.tsx — redirect turns on address blocking
import { notFound, permanentRedirect, redirect } from 'next/navigation'
const route = createPageRoute(content, { blocks: blockRegistry, notFound, permanentRedirect, redirect })
// app/(frontend)/[locale]/layout.tsx — popup + przechwytywanie linków (bez stylów, classNames)
// app/(frontend)/[locale]/layout.tsx — popup + link interception (no styles, classNames)
import { ConstructionNotice } from '@intecion/ipal-kit/client'
<ConstructionNotice
mode={await getConstructionMode(locale)} // z lib/content (createContentHelpers)
mode={await getConstructionMode(locale)} // from lib/content (createContentHelpers)
classNames={{ overlay: '…', dialog: '…', title: '…', message: '…', button: '…' }}
/>
```
`getConstructionMode(locale)` zwraca `{ enabled, allowedPaths, homePath, texts }` (typ
`ConstructionMode`). Czysta logika: `isPathAllowed(pathname, allowedPaths)`,
`constructionNoticeHref(homePath)`, stała `CONSTRUCTION_NOTICE_PARAM` (`@intecion/ipal-kit`).
`getConstructionMode(locale)` returns `{ enabled, allowedPaths, homePath, texts }` (type
`ConstructionMode`). Pure logic: `isPathAllowed(pathname, allowedPaths)`,
`constructionNoticeHref(homePath)`, the constant `CONSTRUCTION_NOTICE_PARAM` (`@intecion/ipal-kit`).
Nowe pola w Site Settings = migracja w projekcie (`payload migrate:create`).
New fields in Site Settings = a migration in the project (`payload migrate:create`).
## Wyłączenie, nadpisanie, rozszerzenie
## Turn off, override, extend
- **Wyłączenie:** przełącznik *Site under construction* w panelu. Zakładka *Under construction* jest
dodawana zawsze, gdy włączony jest moduł `pages` (osobnej opcji nie ma). Bez `redirect` w
`createPageRoute` adresy nie są blokowane; bez `<ConstructionNotice>` linki nie są przechwytywane.
- **Nadpisanie:** wygląd popupu przez `classNames` (`overlay`, `dialog`, `title`, `message`, `button`);
teksty w panelu.
- **Rozszerzenie:** `getConstructionMode(locale)` + `isPathAllowed` / `constructionNoticeHref` pozwalają
dołożyć blokadę we własnych trasach (np. Markdown, wyszukiwarka, MCP), których plugin nie gatuje.
- **Turn off:** the *Site under construction* switch in the admin panel. The *Under construction* tab is
currently always added when the `pages` module is on (there is no separate option). Without `redirect` in
`createPageRoute` addresses are not blocked; without `<ConstructionNotice>` links are not intercepted.
Markdown / MCP without the filter even with the mode on:
`createContentHelpers({ markdown: { isPathVisible: () => true }, mcp: { isPathVisible: () => true } })`;
sitemap / llms.txt without the filter: `createContentHelpers({ underConstructionSeo: false })`.
- **Override:** popup look through `classNames` (`overlay`, `dialog`, `title`, `message`, `button`);
texts in the admin panel. Your own rule = your own `isPathVisible` function in the options above or in `createSearchRoute`.
Access/hooks of the Site Settings global: `ipalKit({ globalOverrides: { 'site-settings': … } })`.
- **Extend:** `getConstructionMode(locale)` + `isPathVisibleIn` / `isPathAllowed` / `pathOf` /
`constructionNoticeHref` let you add blocking in your own routes.
- **Check:** mode on → `/md/pl/<hidden>` = 404, MCP `get_page` = "No page found",
`list_pages` does not show it, the sitemap does not list it.
- **One rule for all visitors** — pages stay static (ISR), with no session check. Saving Site Settings
revalidates the whole site only when the project passes `ipalKit({ revalidatePath })`
(see [hooks.md](./hooks.md)); without it, already rendered/cached pages show the old state until the ISR
window ends.
- **What is not blocked:** the Payload API, the project's own routes that do not pass `isPathVisible`, and your own
search route without `isPathVisible` — the content of "hidden" pages can still be read from them.