Docs in English (part 1), seeding guide, Coolify deployment

- Translate to English every doc the code branches did not touch: AGENT.md,
  developer guide, vibe, CHANGELOG, docs index, module pages, all skills
  except ipal-seo-check (14 pages follow after the security/SEO merge).
  Placeholder marker is now [TO FILL: …]; skill resources renamed to
  section-code.md / nav-code.md. AGENT.md and the ipal-skills pointer
  block say the docs are in English.
- docs/seeding.md: create-only, natural keys, never delete, no users or
  secrets, empty-field globals, fallbackLocale: false, dry run, backup and
  restore, production update guard, seeds vs migrations, Coolify Terminal.
  Seed templates gain --dry-run, the SEED_UPDATE production guard
  (IPAL_SEED_ALLOW_PROD_UPDATE), skip of edited records and a summary.
  "Seeding on production" rule block in AGENT.md.
- Coolify is the single deployment path (deployment, env, developer guide,
  ipal-setup): build vs runtime env, migrations on container start
  (prodMigrations), health check and rolling updates, rollback, backups and
  restore, DNS/Let's Encrypt/CAA. R2: custom domain needs a Cloudflare zone;
  default is media served by the app (R2_PUBLIC_URL empty).
- docsConsistency: no Polish prose outside code/quoted data (pending pages
  listed); IPAL_* names may also be read by shipped skill templates.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-22 17:39:03 +02:00
co-authored by Claude Opus 5.5
parent 6e3979bae6
commit 2d9f3e15d4
47 changed files with 6102 additions and 5355 deletions
+87 -87
View File
@@ -1,8 +1,8 @@
# frontend — `createContentHelpers`, `createPageRoute`, `SiteProviders`
Warstwa, którą projekt wpina w `app/`: jedna fabryka helperów (`src/lib/content.ts`),
gotowa strona catch-all i komponent z providerami layoutu. Wszystko opcjonalne —
każdy kawałek ma niżej poziomowy odpowiednik (content.md, seo.md, links.md).
The layer the project wires into `app/`: one helper factory (`src/lib/content.ts`),
a ready catch-all page and a component with the layout providers. All optional —
each piece has a lower-level equivalent (content.md, seo.md, links.md).
## `createContentHelpers` → `src/lib/content.ts`
@@ -19,44 +19,44 @@ export const {
} = createContentHelpers({ config, content: contentConfig, i18n: i18nConfig })
```
Wszystkie odczyty owinięte w React `cache()`; instancja Payloada powstaje raz w fabryce
i jest współdzielona przez helpery (generateMetadata i strona dzielą zapytania).
All reads are wrapped in React `cache()`; the Payload instance is created once in the factory
and shared by the helpers (generateMetadata and the page share queries).
### Opcje
### Options
| Opcja | Domyślnie | Co robi |
| Option | Default | What it does |
|---|---|---|
| `config` | — (wymagane) | config Payloada (promise albo obiekt) |
| `content` | — | ta sama `ContentOption` co w pluginie (content.md) |
| `i18n` | — | `I18nConfig`; **bez niego rzucają**: `generatePageMetadata`, `getPageJsonLd`, `sitemap`, `getLinkOptions`/`resolveLink`/`resolveNav`/`getSystemLinks`, `resolvePageRedirect`, `getConstructionMode`, `getSiteShell`, `llmsRoute`, `llmsFullRoute`, `mcpGET`/`mcpPOST`, `manifest` |
| `baseUrl` | `NEXT_PUBLIC_SERVER_URL`, potem `''` | origin dla sitemap/robots/canonical/JSON-LD |
| `pagesSlug` | `'pages'` | kolekcja stron |
| `settingsSlug` | `'site-settings'` | global SiteSettings |
| `redirectCollections` | `[{ slug: 'pages' }]` | kolekcje sprawdzane przez `resolvePageRedirect` (slug history) |
| `markdown` | — | `{ frontmatter, layoutField, overrides }` dla `markdownRoute` |
| `markdownAlternate` | wył. | `true`/prefiks → `generatePageMetadata` dokłada `<link rel="alternate" type="text/markdown">` (strony indeksowalne) |
| `mcp` | — | `{ serverName, serverVersion, rateLimit, maxBatch, clientIp }` dla `mcpGET`/`mcpPOST` (mcp.md) |
| `pageJsonLd` | — | domyślne opcje `getPageJsonLd`: `breadcrumbs`, `entryType`, `entries`, `faq`, `pageType` |
| `robots` | — | `RobotsOptions` dla `robots` (seo.md) |
| `siteJsonLd` | WebSite + Organization z Site Settings | funkcja zastępuje, `false` = brak |
| `sitemapImages` | obraz SEO dokumentu | `(doc) => url[]` |
| `sitemapStyle` | styl wbudowany | `false` = surowy XML |
| `summaryField` | — | pole z `buildSummaryField` dla llms.txt / MCP |
| `config` | — (required) | Payload config (promise or object) |
| `content` | — | the same `ContentOption` as in the plugin (content.md) |
| `i18n` | — | `I18nConfig`; **without it these throw**: `generatePageMetadata`, `getPageJsonLd`, `sitemap`, `getLinkOptions`/`resolveLink`/`resolveNav`/`getSystemLinks`, `resolvePageRedirect`, `getConstructionMode`, `getSiteShell`, `llmsRoute`, `llmsFullRoute`, `mcpGET`/`mcpPOST`, `manifest` |
| `baseUrl` | `NEXT_PUBLIC_SERVER_URL`, then `''` | origin for sitemap/robots/canonical/JSON-LD |
| `pagesSlug` | `'pages'` | pages collection |
| `settingsSlug` | `'site-settings'` | SiteSettings global |
| `redirectCollections` | `[{ slug: 'pages' }]` | collections checked by `resolvePageRedirect` (slug history) |
| `markdown` | — | `{ frontmatter, layoutField, overrides }` for `markdownRoute` |
| `markdownAlternate` | off | `true`/prefix → `generatePageMetadata` adds `<link rel="alternate" type="text/markdown">` (indexable pages) |
| `mcp` | — | `{ serverName, serverVersion, rateLimit, maxBatch, clientIp }` for `mcpGET`/`mcpPOST` (mcp.md) |
| `pageJsonLd` | — | default `getPageJsonLd` options: `breadcrumbs`, `entryType`, `entries`, `faq`, `pageType` |
| `robots` | — | `RobotsOptions` for `robots` (seo.md) |
| `siteJsonLd` | WebSite + Organization from Site Settings | a function replaces it, `false` = none |
| `sitemapImages` | the document's SEO image | `(doc) => url[]` |
| `sitemapStyle` | built-in style | `false` = raw XML |
| `summaryField` | — | field from `buildSummaryField` for llms.txt / MCP |
### Zwracane klucze (to, co eksportuje `@/lib/content`)
### Returned keys (what `@/lib/content` exports)
| Klucz | Sygnatura / użycie |
| Key | Signature / usage |
|---|---|
| `getCachedPayload` | `() => Promise<Payload>` |
| `getConfiguredLocales` | `() => Promise<string[]>` (z `config.localization`) |
| `getSettings` | `(locale)` — SiteSettings, `depth: 2`, jeden odczyt na język na request |
| `getConfiguredLocales` | `() => Promise<string[]>` (from `config.localization`) |
| `getSettings` | `(locale)` — SiteSettings, `depth: 2`, one read per language per request |
| `resolveRoute` | `(locale, segments, page)` → `ResolvedRoute \| null` (content.md) |
| `getEntries` | `(collection, locale, page, perPage)` → `ArchiveEntries` |
| `getNotFoundPage` | `(locale)` — strona 404 z System Pages albo `null`, nie rzuca (pages.md) |
| `generatePageMetadata` | `(locale, segments, page = 1)` → `Metadata` dla `generateMetadata` |
| `getPageJsonLd` | `(locale, segments, options?)` → węzły dla `<JsonLdGraph>` (WebPage / BlogPosting / CollectionPage, BreadcrumbList, FAQPage); `[]` dla noindex |
| `generateStaticParams` | patrz niżej |
| `sitemap` | `app/sitemap.ts`: `export { sitemap as default }` (błąd bazy → `[]`) |
| `getNotFoundPage` | `(locale)` — 404 page from System Pages or `null`, does not throw (pages.md) |
| `generatePageMetadata` | `(locale, segments, page = 1)` → `Metadata` for `generateMetadata` |
| `getPageJsonLd` | `(locale, segments, options?)` → nodes for `<JsonLdGraph>` (WebPage / BlogPosting / CollectionPage, BreadcrumbList, FAQPage); `[]` for noindex |
| `generateStaticParams` | see below |
| `sitemap` | `app/sitemap.ts`: `export { sitemap as default }` (database error → `[]`) |
| `sitemapRoute` | `app/sitemap.xml/route.ts`: `export { sitemapRoute as GET }` |
| `robots` | `app/robots.ts`: `export { robots as default }` |
| `manifest` | `app/manifest.ts`: `export { manifest as default }` |
@@ -64,30 +64,30 @@ i jest współdzielona przez helpery (generateMetadata i strona dzielą zapytani
| `markdownRoute` | `app/md/[locale]/[[...slug]]/route.ts` (content.md) |
| `mcpGET`, `mcpPOST` | `app/api/mcp/route.ts` (mcp.md) |
| `healthRoute` | `app/api/health/route.ts` |
| `indexNowKeyRoute` | trasa pliku klucza IndexNow (seo.md) |
| `getHomeSlug` | `(locale)` — slug strony głównej |
| `getLinkOptions` | `(locale)` — opcje dla `resolveLinkHref` / `RenderForm linkOptions` (z archiwami `content`) |
| `indexNowKeyRoute` | IndexNow key file route (seo.md) |
| `getHomeSlug` | `(locale)` — home page slug |
| `getLinkOptions` | `(locale)` — options for `resolveLinkHref` / `RenderForm linkOptions` (with `content` archives) |
| `resolveLink`, `resolveNav`, `getSystemLinks` | links.md |
| `resolvePageRedirect` | `(locale, segments)` → nowa ścieżka ze slug history albo `null` |
| `getConstructionMode` | `(locale)` — stan „strona w budowie” (construction.md) |
| `getFormTexts` | `(locale)` — teksty formularzy z Notifications |
| `getSiteShell` | `(locale)` → `SiteShell` dla layoutu (consent, analytics, turnstile, jsonLd, settings, theme, formTexts) |
| `i18n` | przekazany `I18nConfig` |
| `resolvePageRedirect` | `(locale, segments)` → new path from slug history or `null` |
| `getConstructionMode` | `(locale)` — under-construction mode state (construction.md) |
| `getFormTexts` | `(locale)` — form texts from Notifications |
| `getSiteShell` | `(locale)` → `SiteShell` for the layout (consent, analytics, turnstile, jsonLd, settings, theme, formTexts) |
| `i18n` | the `I18nConfig` passed in |
### `generateStaticParams` — co naprawdę generuje
### `generateStaticParams` — what it really generates
Docstring w `createContentHelpers.ts` (~470) mówi o kolekcjach treści, ale kod (~512–518)
pyta **tylko kolekcję `pagesSlug`**, `limit: 1000` na język, bez paginacji:
The docstring in `createContentHelpers.ts` (~470) talks about content collections, but the code (~512–518)
queries **only the `pagesSlug` collection**, `limit: 1000` per language, no pagination:
- strona główna → `slug: []` (root), strona przypisana jako 404 i slugi `404`/`500`/`error`/`not-found` pominięte,
- drafty odfiltrowane w pamięci, strony `noindex` **zostają** (muszą się renderować),
- jeden język → `{ slug }[]`, wiele → `{ locale, slug }[]`,
- **wpisy kolekcji `content` i strony archiwów > 1 nie są generowane**, ponad 1000 stron na język też nie — renderują się na żądanie,
- baza niedostępna w buildzie → `[]` + ostrzeżenie.
- home page → `slug: []` (root); the page assigned as 404 and the slugs `404`/`500`/`error`/`not-found` are skipped,
- drafts filtered out in memory, `noindex` pages **stay** (they must render),
- one language → `{ slug }[]`, several → `{ locale, slug }[]`,
- **`content` collection entries and archive pages > 1 are not generated**, nor more than 1000 pages per language — they render on request,
- database unreachable during the build → `[]` + a warning.
Wpisy jako SSG: własny `generateStaticParams`, który łączy wynik helpera z `buildEntryPath`/zapytaniem o wpisy.
Entries as SSG: your own `generateStaticParams` that merges the helper's result with `buildEntryPath`/a query for entries.
## `createPageRoute` — strona catch-all (`/rsc`)
## `createPageRoute` — catch-all page (`/rsc`)
```tsx
// app/(frontend)/[locale]/[[...slug]]/page.tsx
@@ -96,31 +96,31 @@ import { createPageRoute } from '@intecion/ipal-kit/rsc'
import * as content from '@/lib/content'
import { blockRegistry } from '@/blocks/registry'
export const revalidate = 3600 // literał w pliku
export const revalidate = 3600 // literal in the file
const route = createPageRoute(content, { blocks: blockRegistry, notFound, permanentRedirect, redirect })
export default route.Page
export const generateMetadata = route.generateMetadata
export const generateStaticParams = route.generateStaticParams
```
Kolejność w `Page`: tryb „w budowie” (gdy podano `redirect`) → `resolveRoute(locale, segments, 1)` →
brak trasy: `resolvePageRedirect` (308) albo `onMissing` → slug strony głównej pod własnym adresem: 308 na root
(`homeAlias`) → `RenderBlocks` z `{ locale, isFirst, …blockProps }` → `render` (opcjonalnie) → `<JsonLdGraph>`.
Order in `Page`: under-construction mode (when `redirect` is passed) → `resolveRoute(locale, segments, 1)` →
no route: `resolvePageRedirect` (308) or `onMissing` → home page slug at its own address: 308 to root
(`homeAlias`) → `RenderBlocks` with `{ locale, isFirst, …blockProps }` → `render` (optional) → `<JsonLdGraph>`.
| Opcja | Domyślnie | Co robi |
| Option | Default | What it does |
|---|---|---|
| `blocks` | — (wymagane) | rejestr `blockType → komponent` |
| `notFound`, `permanentRedirect` | — (wymagane) | z `next/navigation` (wstrzykiwane) |
| `redirect` | — | z `next/navigation`; włącza tryb „w budowie” i `onMissing: 'redirectHome'` |
| `onMissing` | `'notFound'` | `'redirectHome'` (307 na stronę główną) albo funkcja `({ locale, segments }) => …` |
| `homeAlias` | `'redirect'` | `false` = strona główna renderuje się też pod własnym slugiem |
| `blockProps` | — | `({ doc, locale }) => props` dla każdego bloku |
| `render` | — | `({ route, blocks, locale, segments }) => ReactNode \| undefined` — własny widok archiwum/wpisu |
| `jsonLd` | `true` | `false` albo opcje `getPageJsonLd` |
| `layoutField` | `'layout'` | pole z blokami |
| `blocks` | — (required) | `blockType → component` registry |
| `notFound`, `permanentRedirect` | — (required) | from `next/navigation` (injected) |
| `redirect` | — | from `next/navigation`; turns on under-construction mode and `onMissing: 'redirectHome'` |
| `onMissing` | `'notFound'` | `'redirectHome'` (307 to the home page) or a function `({ locale, segments }) => …` |
| `homeAlias` | `'redirect'` | `false` = the home page also renders at its own slug |
| `blockProps` | — | `({ doc, locale }) => props` for every block |
| `render` | — | `({ route, blocks, locale, segments }) => ReactNode \| undefined` — your own archive/entry view |
| `jsonLd` | `true` | `false` or `getPageJsonLd` options |
| `layoutField` | `'layout'` | field with the blocks |
**Ograniczenie:** zawsze strona 1 — `?page=` nie jest czytane (paginacja archiwum: content.md).
Brak `[locale]` w params → `i18n.defaultLocale` (strona jednojęzyczna).
**Limitation:** always page 1 — `?page=` is not read (archive pagination: content.md).
No `[locale]` in params → `i18n.defaultLocale` (single-language site).
404: `createNotFoundPage` / `renderNotFoundView` — pages.md.
@@ -138,29 +138,29 @@ import { getSiteShell } from '@/lib/content'
</body>
```
Renderuje: `<ThemeScript>` (gdy `theme`), `<MediaPreconnect>`, `<JsonLdGraph>` (site JSON-LD + `jsonLd`),
`<ConsentProvider>` z `<TurnstileProvider>`, `<CookieBanner>`, `<CookieButton>`, `<Analytics>`, `<PageStats>`.
Nie montuje `AlternateLinksProvider` (i18n.md) — dodaj go sam, jeśli używasz `LanguageSwitcher`.
Renders: `<ThemeScript>` (when `theme`), `<MediaPreconnect>`, `<JsonLdGraph>` (site JSON-LD + `jsonLd`),
`<ConsentProvider>` with `<TurnstileProvider>`, `<CookieBanner>`, `<CookieButton>`, `<Analytics>`, `<PageStats>`.
It does not mount `AlternateLinksProvider` (i18n.md) — add it yourself if you use `LanguageSwitcher`.
| Prop | Domyślnie | Co robi |
| Prop | Default | What it does |
|---|---|---|
| `shell` | — (wymagane) | wynik `getSiteShell(locale)` |
| `logEndpoint` | — | endpoint logu zgód (`consentLog`) |
| `banner` | `<CookieBanner />` | własny banner albo `false` |
| `cookieButton` | `<CookieButton />` | własny przycisk albo `false` |
| `analytics` | włączone | dodatkowe propsy `<Analytics>` albo `false` = bez tagów |
| `cookieMap` | — | dodatkowe cookie per kategoria do sprzątania po cofnięciu zgody |
| `jsonLd` | `[]` | dodatkowe węzły JSON-LD |
| `preconnect` | `true` | `<link rel=preconnect>` do originu mediów |
| `stats` | wył. | `true`/props → `<PageStats>` (stats.md) |
| `theme` | `false` | `<ThemeScript>` przed pierwszym malowaniem (theme.md) |
| `shell` | — (required) | result of `getSiteShell(locale)` |
| `logEndpoint` | — | consent log endpoint (`consentLog`) |
| `banner` | `<CookieBanner />` | your own banner or `false` |
| `cookieButton` | `<CookieButton />` | your own button or `false` |
| `analytics` | on | extra `<Analytics>` props or `false` = no tags |
| `cookieMap` | — | extra cookies per category to clean up after consent is withdrawn |
| `jsonLd` | `[]` | extra JSON-LD nodes |
| `preconnect` | `true` | `<link rel=preconnect>` to the media origin |
| `stats` | off | `true`/props → `<PageStats>` (stats.md) |
| `theme` | `false` | `<ThemeScript>` before the first paint (theme.md) |
## Wyłączenie, nadpisanie, rozszerzenie
## Turn off, override, extend
- Wszystkie trzy są opcjonalne — projekt może złożyć stronę i layout z niższych klocków
- All three are optional — the project can build the page and layout from lower-level pieces
(`resolveRoute`, `getArchiveEntries`, `createPageMetadata`, `RenderBlocks`, `ConsentProvider`…).
- Każdy klucz z `createContentHelpers` można pominąć w destrukturyzacji albo zastąpić własną funkcją
o tej samej nazwie w `src/lib/content.ts` (np. własny `generateStaticParams` z wpisami).
- `createPageRoute`: własny widok przez `render`, własne 404/redirect przez `onMissing`, dodatkowe propsy bloków przez `blockProps`, JSON-LD przez `jsonLd`.
- `SiteProviders`: `banner`, `cookieButton`, `analytics` przyjmują własny element albo `false`.
- Nie da się obecnie zmienić paginacji `createPageRoute` ani zakresu `generateStaticParams` opcją — tylko własnym kodem.
- Any key from `createContentHelpers` can be left out of the destructuring or replaced with your own function
of the same name in `src/lib/content.ts` (e.g. your own `generateStaticParams` with entries).
- `createPageRoute`: your own view through `render`, your own 404/redirect through `onMissing`, extra block props through `blockProps`, JSON-LD through `jsonLd`.
- `SiteProviders`: `banner`, `cookieButton`, `analytics` accept your own element or `false`.
- `createPageRoute` pagination and the `generateStaticParams` scope currently cannot be changed with an option — only with your own code.