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:
co-authored by
Claude Opus 5.5
parent
6e3979bae6
commit
2d9f3e15d4
+136
-136
@@ -1,81 +1,81 @@
|
||||
# pages
|
||||
|
||||
System pages: centralne przypisanie ról (homepage / notFound / privacyPolicy /
|
||||
cookiePolicy / termsOfService) do dokumentów z klienckiej kolekcji Pages, w SiteSettings.
|
||||
Front rozwiązuje rolę na ścieżkę locale-aware.
|
||||
System pages: central assignment of roles (homepage / notFound / privacyPolicy /
|
||||
cookiePolicy / termsOfService) to documents in the client's Pages collection, in SiteSettings.
|
||||
The front end resolves a role to a locale-aware path.
|
||||
|
||||
## Config (payload.config.ts)
|
||||
|
||||
```ts
|
||||
ipalKit({
|
||||
pages: {
|
||||
slug: 'pages', // slug Twojej kolekcji Pages
|
||||
// roles: ['homepage', 'privacyPolicy', 'cookiePolicy'], // domyślnie wszystkie
|
||||
slug: 'pages', // the slug of your Pages collection
|
||||
// roles: ['homepage', 'privacyPolicy', 'cookiePolicy'], // default: all
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
| Opcja | Domyślnie | Co robi |
|
||||
| Option | Default | What it does |
|
||||
|---|---|---|
|
||||
| `slug` | — (wymagane) | slug kolekcji Pages klienta |
|
||||
| `roles` | wszystkie (`ALL_SYSTEM_PAGE_ROLES`) | które role pokazać jako pola |
|
||||
| `slug` | — (required) | slug of the client's Pages collection |
|
||||
| `roles` | all (`ALL_SYSTEM_PAGE_ROLES`) | which roles to show as fields |
|
||||
|
||||
Dodaje tab **System Pages** w SiteSettings z polami relationship (nazwa pola = rola:
|
||||
`homepage`, `notFound`, `privacyPolicy`, `cookiePolicy`, `termsOfService`) do Twojej
|
||||
kolekcji Pages. Edytor wybiera, który dokument pełni którą rolę. Plugin nie
|
||||
zna Twojej kolekcji — slug podajesz w opcji. Opcja `pages` włącza też tab
|
||||
**Under construction** ([construction.md](./construction.md)) i jest wymagana przez `content`.
|
||||
Adds a **System Pages** tab in SiteSettings with relationship fields (field name = role:
|
||||
`homepage`, `notFound`, `privacyPolicy`, `cookiePolicy`, `termsOfService`) to your
|
||||
Pages collection. The editor picks which document plays which role. The plugin does not
|
||||
know your collection — you give the slug in the option. The `pages` option also turns on the
|
||||
**Under construction** tab ([construction.md](./construction.md)) and is required by `content`.
|
||||
|
||||
## Front — rozwiązanie ścieżki roli
|
||||
## Front end — resolving a role's path
|
||||
|
||||
```ts
|
||||
import { getSystemPagePath } from '@intecion/ipal-kit'
|
||||
|
||||
// SiteSettings z locale:'all' + depth:1 (żeby relationship był obiektem, nie ID)
|
||||
// SiteSettings with locale:'all' + depth:1 (so the relationship is an object, not an ID)
|
||||
const settings = await payload.findGlobal({
|
||||
slug: 'site-settings', locale: 'all', depth: 1,
|
||||
})
|
||||
|
||||
// homepage w locale 'pl'
|
||||
// homepage in locale 'pl'
|
||||
getSystemPagePath({ page: settings.homepage, locale: 'pl', config })
|
||||
// → '/pl' (home slug zwija się do roota) lub '/pl/strona-glowna'
|
||||
// → '/pl' (the home slug collapses to the root) or '/pl/strona-glowna'
|
||||
|
||||
// polityka prywatności w 'en'
|
||||
// privacy policy in 'en'
|
||||
getSystemPagePath({ page: settings.privacyPolicy, locale: 'en', config })
|
||||
// → '/en/privacy-policy'
|
||||
```
|
||||
|
||||
Zwraca `undefined`, gdy rola nieprzypisana lub dokument nie ma slug w danym
|
||||
locale — caller decyduje o fallbacku (404, redirect). Do roota zwija się slug równy
|
||||
`homeSlug` (domyślnie `'home'`; string albo mapa per język) — dla strony głównej
|
||||
o innym slugu podaj `homeSlug`.
|
||||
Returns `undefined` when the role is unassigned or the document has no slug in the given
|
||||
locale — the caller decides the fallback (404, redirect). A slug equal to
|
||||
`homeSlug` (default `'home'`; a string or a per-language map) collapses to the root — for a home page
|
||||
with a different slug, pass `homeSlug`.
|
||||
|
||||
## Typowy przypadek: `/{locale}` → strona główna
|
||||
## Typical case: `/{locale}` → home page
|
||||
|
||||
W trasie `[locale]/page.tsx` czytasz `settings.homepage`, bierzesz jego slug
|
||||
w bieżącym locale i renderujesz ten dokument. Link do polityki prywatności w
|
||||
stopce / bannerze cookies bierzesz z `getSystemPagePath({ page: settings.privacyPolicy, locale, config })`
|
||||
— albo prościej `getSystemLinks(locale)` z `@/lib/content` (href + tytuł strony, patrz links.md).
|
||||
In the `[locale]/page.tsx` route you read `settings.homepage`, take its slug
|
||||
in the current locale and render that document. The privacy policy link in the
|
||||
footer / cookie banner comes from `getSystemPagePath({ page: settings.privacyPolicy, locale, config })`
|
||||
— or, simpler, `getSystemLinks(locale)` from `@/lib/content` (href + page title, see links.md).
|
||||
|
||||
## Role
|
||||
## Roles
|
||||
|
||||
```ts
|
||||
import { ALL_SYSTEM_PAGE_ROLES } from '@intecion/ipal-kit'
|
||||
// ['homepage', 'notFound', 'privacyPolicy', 'cookiePolicy', 'termsOfService']
|
||||
```
|
||||
|
||||
## Strona 404 — wybierana w panelu (od 1.7.12)
|
||||
## 404 page — chosen in the admin panel (since 1.7.12)
|
||||
|
||||
Site Settings → System Pages → **404 (Not Found)**. Edytor wybiera:
|
||||
Site Settings → System Pages → **404 (Not Found)**. The editor picks:
|
||||
|
||||
- dedykowaną stronę „Nie znaleziono” (np. slug `strona-nie-znaleziona`), **albo**
|
||||
- stronę główną (część klientów tak woli), **albo**
|
||||
- nic → projekt pokazuje wbudowany fallback z `not-found.tsx`.
|
||||
- a dedicated "Not found" page (e.g. slug `strona-nie-znaleziona`), **or**
|
||||
- the home page (some clients prefer that), **or**
|
||||
- nothing → the project shows the built-in fallback from `not-found.tsx`.
|
||||
|
||||
Projekt — dwa pliki w `app/(frontend)/[locale]/` (od 1.12.0, **wariant leniwy — zalecany**):
|
||||
Project — two files in `app/(frontend)/[locale]/` (since 1.12.0, **lazy variant — recommended**):
|
||||
|
||||
```ts
|
||||
// notFoundView.ts — server action z treścią 404 w JEDNYM języku
|
||||
// notFoundView.ts — server action with the 404 content in ONE language
|
||||
'use server'
|
||||
import { renderNotFoundView } from '@intecion/ipal-kit/rsc'
|
||||
import * as content from '@/lib/content'
|
||||
@@ -84,7 +84,7 @@ import { blockRegistry } from '@/blocks/registry'
|
||||
export async function loadNotFoundView(locale: string) {
|
||||
return renderNotFoundView(content, {
|
||||
blocks: blockRegistry,
|
||||
fallback: <h1>404</h1>, // gdy w panelu nie wybrano strony 404 (albo per język: (locale) => …)
|
||||
fallback: <h1>404</h1>, // when no 404 page is chosen in the admin panel (or per language: (locale) => …)
|
||||
// blockProps: async ({ locale }) => ({ formTexts: await content.getFormTexts(locale), sendForm }),
|
||||
}, locale)
|
||||
}
|
||||
@@ -97,47 +97,47 @@ import { loadNotFoundView } from './notFoundView'
|
||||
|
||||
export default createNotFoundPage(content, { load: loadNotFoundView })
|
||||
```
|
||||
(`fallback` z JSX → plik `notFoundView.tsx`.)
|
||||
(`fallback` with JSX → file `notFoundView.tsx`.)
|
||||
|
||||
**Dlaczego leniwy:** Next wkłada drzewo `not-found` layoutu do danych RSC (`self.__next_f`) **każdej** strony
|
||||
pod nim — router potrzebuje go do 404 po stronie klienta. Wariant natychmiastowy renderuje tam stronę 404 z panelu
|
||||
w każdym języku, więc każda strona wiezie ją w HTML (404 = strona główna przy 2 językach: HTML strony głównej
|
||||
195 → 146 KB gzip, strony kontaktu 153 → 104 KB). W wariancie leniwym w danych jest tylko `<NotFoundLoader>`
|
||||
(`/client`); treść przychodzi z server action dopiero, gdy 404 się wyświetla. Język z adresu (`/en/...`);
|
||||
`renderNotFoundView` przyjmuje tylko skonfigurowane języki (inne → domyślny). Status 404 bez zmian; treść
|
||||
pojawia się po hydratacji (strona 404 i tak nie jest indeksowana).
|
||||
**Why lazy:** Next puts the layout's `not-found` tree into the RSC data (`self.__next_f`) of **every** page
|
||||
under it — the router needs it for a client-side 404. The immediate variant renders the 404 page from the admin panel there
|
||||
in every language, so every page carries it in its HTML (404 = home page with 2 languages: home page HTML
|
||||
195 → 146 KB gzip, contact page 153 → 104 KB). In the lazy variant the data holds only `<NotFoundLoader>`
|
||||
(`/client`); the content arrives from the server action only when the 404 is shown. Language from the URL (`/en/...`);
|
||||
`renderNotFoundView` accepts only configured languages (others → the default). The 404 status is unchanged; the content
|
||||
appears after hydration (the 404 page is not indexed anyway).
|
||||
|
||||
Wariant natychmiastowy (do 1.11.x jedyny) — treść już w HTML, za cenę rozmiaru każdej strony:
|
||||
Immediate variant (the only one up to 1.11.x) — content already in the HTML, at the cost of every page's size:
|
||||
```tsx
|
||||
export default createNotFoundPage(content, { blocks: blockRegistry, fallback: <h1>404</h1> })
|
||||
```
|
||||
Robi dokładnie to, co pełny plik poniżej (widok dla każdego języka + `LocaleView`, bez `headers()`).
|
||||
It does exactly what the full file below does (a view for every language + `LocaleView`, no `headers()`).
|
||||
|
||||
Każdy blok strony dostaje `locale`, wynik `blockProps` i **`isFirst`** (1.11.0) — `true` dla pierwszej sekcji:
|
||||
jej nagłówek jest jedynym `h1` strony (`<SectionHeader as={isFirst ? 'h1' : 'h2'}>`), pozostałe dają `h2`.
|
||||
Every page block gets `locale`, the `blockProps` result and **`isFirst`** (1.11.0) — `true` for the first section:
|
||||
its heading is the page's only `h1` (`<SectionHeader as={isFirst ? 'h1' : 'h2'}>`), the others give `h2`.
|
||||
|
||||
Strona catch-all z tymi samymi helperami: `createPageRoute(content, { blocks, notFound, permanentRedirect,
|
||||
blockProps, render, jsonLd, layoutField, redirect, onMissing, homeAlias })` — PROGRAMISTA §2.8. Zwraca
|
||||
`{ Page, generateMetadata, generateStaticParams }`. `render` daje własny widok dla archiwum lub wpisu
|
||||
(`route.type`: `page | home | archive | entry`), reszta zostaje domyślna. `jsonLd` (domyślnie `true`) dokłada
|
||||
`<JsonLdGraph>` z `getPageJsonLd`; `layoutField` — pole z blokami (`'layout'`). Trasa zawsze rozwiązuje
|
||||
stronę 1 — nie obsługuje `?page=` (paginacja archiwum: content.md). Pełne opcje: [frontend.md](./frontend.md).
|
||||
Opcja `redirect` (z `next/navigation`) włącza tryb „strona w budowie” — [construction.md](./construction.md).
|
||||
The catch-all page with the same helpers: `createPageRoute(content, { blocks, notFound, permanentRedirect,
|
||||
blockProps, render, jsonLd, layoutField, redirect, onMissing, homeAlias })` — PROGRAMISTA §2.8. Returns
|
||||
`{ Page, generateMetadata, generateStaticParams }`. `render` gives your own view for an archive or entry
|
||||
(`route.type`: `page | home | archive | entry`), the rest stays default. `jsonLd` (default `true`) adds
|
||||
`<JsonLdGraph>` from `getPageJsonLd`; `layoutField` — the blocks field (`'layout'`). The route always resolves
|
||||
page 1 — it does not handle `?page=` (archive pagination: content.md). Full options: [frontend.md](./frontend.md).
|
||||
The `redirect` option (from `next/navigation`) turns on under-construction mode — [construction.md](./construction.md).
|
||||
|
||||
**Brak strony → strona główna** (1.11.1): `onMissing: 'redirectHome'` (wymaga `redirect`) — adres bez strony
|
||||
i bez starego sluga (np. wycofane `/pl/uslugi`) przekierowuje (307) na stronę główną w tym samym języku
|
||||
(System Pages → Homepage). Bez przypisanej strony głównej albo gdy brakuje jej samej → zwykłe 404.
|
||||
Domyślnie `'notFound'`; własna decyzja: `onMissing: ({ locale, segments }) => redirect(…)`.
|
||||
**Missing page → home page** (1.11.1): `onMissing: 'redirectHome'` (needs `redirect`) — a URL with no page
|
||||
and no old slug (e.g. a retired `/pl/uslugi`) redirects (307) to the home page in the same language
|
||||
(System Pages → Homepage). No home page assigned, or the home page itself missing → a plain 404.
|
||||
Default `'notFound'`; your own decision: `onMissing: ({ locale, segments }) => redirect(…)`.
|
||||
|
||||
```tsx
|
||||
const route = createPageRoute(content, { blocks: blockRegistry, notFound, permanentRedirect, redirect, onMissing: 'redirectHome' })
|
||||
```
|
||||
|
||||
**Strona główna pod własnym slugiem** (1.12.2): `/pl/home` (slug strony przypisanej jako
|
||||
Homepage) → 308 na `/pl` — jeden adres strony (canonical i tak wskazywał root; Search Console
|
||||
zgłaszało duplikat). Wyłączenie: `createPageRoute(…, { homeAlias: false })`.
|
||||
**Home page under its own slug** (1.12.2): `/pl/home` (the slug of the page assigned as
|
||||
Homepage) → 308 to `/pl` — one URL per page (canonical already pointed to the root; Search Console
|
||||
reported a duplicate). Turn off: `createPageRoute(…, { homeAlias: false })`.
|
||||
|
||||
Ręcznie (pełny plik — gdy potrzebujesz czegoś, czego `createNotFoundPage` nie ma):
|
||||
Manually (full file — when you need something `createNotFoundPage` does not have):
|
||||
|
||||
```tsx
|
||||
import React from 'react'
|
||||
@@ -193,112 +193,112 @@ export default async function NotFound() {
|
||||
}
|
||||
```
|
||||
|
||||
> **NIE czytaj `headers()` w `not-found.tsx`** (`LocaleView` od 1.8.2). `not-found.tsx` nie dostaje
|
||||
> `params`, ale `headers()` (np. `x-locale` z proxy) zamienia stronę SSG/ISR w
|
||||
> dynamiczną — Next 16 rzuca `Page changed from static to dynamic at runtime`
|
||||
> (AGENT.md §4.6). Dlatego serwer renderuje stronę 404 **dla każdego języka**
|
||||
> (same odczyty z bazy — trasa zostaje statyczna), a `<LocaleView>` (komponent
|
||||
> kliencki pluginu) wybiera wersję po pierwszym segmencie URL (`usePathname`).
|
||||
> Działa też przy SSR — HTML ma od razu właściwy język. Layout `[locale]`
|
||||
> (nagłówek, menu, stopka) i tak dostaje `params.locale` z URL.
|
||||
> **Do NOT read `headers()` in `not-found.tsx`** (`LocaleView` since 1.8.2). `not-found.tsx` gets no
|
||||
> `params`, but `headers()` (e.g. `x-locale` from the proxy) turns an SSG/ISR page into a
|
||||
> dynamic one — Next 16 throws `Page changed from static to dynamic at runtime`
|
||||
> (AGENT.md §4.6). So the server renders the 404 page **for every language**
|
||||
> (DB reads only — the route stays static), and `<LocaleView>` (the plugin's client
|
||||
> component) picks the version by the first URL segment (`usePathname`).
|
||||
> It also works with SSR — the HTML has the right language right away. The `[locale]` layout
|
||||
> (header, menu, footer) gets `params.locale` from the URL anyway.
|
||||
|
||||
Status HTTP zostaje **404** (renderuje go Next po `notFound()`), treść jest z
|
||||
panelu we właściwym języku. Koszt: w payloadzie RSC strony 404 są wersje dla
|
||||
wszystkich języków — przy stronie 404 to pomijalne.
|
||||
The HTTP status stays **404** (Next renders it after `notFound()`), the content comes from the
|
||||
admin panel in the right language. Cost: the 404 page's RSC payload holds versions for
|
||||
all languages — negligible for a 404 page.
|
||||
|
||||
Co plugin robi automatycznie z przypisaną stroną 404:
|
||||
What the plugin does automatically with an assigned 404 page:
|
||||
|
||||
| Miejsce | Zachowanie |
|
||||
| Place | Behavior |
|
||||
|---|---|
|
||||
| `resolveRoute` | bezpośrednie wejście na `/pl/strona-nie-znaleziona` → `null` → `notFound()` → prawdziwy 404 (bez soft-404 / duplikatu z kodem 200) |
|
||||
| sitemap | wykluczona po ID (slug może być dowolny) |
|
||||
| `generateStaticParams` | pominięta (nie jest osobnym URL-em) |
|
||||
| `getNotFoundPage` / `resolveNotFoundPage` | nigdy nie rzuca — brak bazy w buildzie = fallback |
|
||||
| `resolveRoute` | visiting `/pl/strona-nie-znaleziona` directly → `null` → `notFound()` → a real 404 (no soft-404 / duplicate with status 200) |
|
||||
| sitemap | excluded by ID (the slug can be anything) |
|
||||
| `generateStaticParams` | skipped (it is not a separate URL) |
|
||||
| `getNotFoundPage` / `resolveNotFoundPage` | never throws — no database during the build = fallback |
|
||||
|
||||
Gdy 404 = strona główna, nic z powyższego nie ukrywa strony głównej — dalej
|
||||
działa pod `/{locale}` i jest w sitemapie; dodatkowo jej treść pokazuje się pod
|
||||
nieznanymi URL-ami (z kodem 404).
|
||||
When 404 = the home page, none of the above hides the home page — it still
|
||||
works under `/{locale}` and is in the sitemap; on top of that its content shows under
|
||||
unknown URLs (with status 404).
|
||||
|
||||
Bez `createContentHelpers`: `resolveNotFoundPage({ payload, locale })` z
|
||||
Without `createContentHelpers`: `resolveNotFoundPage({ payload, locale })` from
|
||||
`@intecion/ipal-kit`.
|
||||
|
||||
Wskazówka: zaznacz na dedykowanej stronie 404 **noindex** — wtedy wypada też z
|
||||
llms.txt i wyszukiwarki.
|
||||
Tip: tick **noindex** on a dedicated 404 page — then it also drops out of
|
||||
llms.txt and search.
|
||||
|
||||
## KRYTYCZNE: generateStaticParams dla [[...slug]] (SEO + head)
|
||||
## CRITICAL: generateStaticParams for [[...slug]] (SEO + head)
|
||||
|
||||
Trasa `[[...slug]]` (opcjonalny catch-all) BEZ `generateStaticParams` jest przez
|
||||
Next traktowana jako **dynamiczna** (`ƒ Dynamic`). W trybie dynamicznym z React 19
|
||||
serwer wysyła pusty `<head>`, a metadata streamuje na końcu `<body>` — crawlery
|
||||
(Lighthouse, Screaming Frog) nie widzą `<meta description>` w head → SEO spada.
|
||||
Next treats a `[[...slug]]` route (optional catch-all) WITHOUT `generateStaticParams`
|
||||
as **dynamic** (`ƒ Dynamic`). In dynamic mode with React 19 the
|
||||
server sends an empty `<head>`, and metadata streams at the end of `<body>` — crawlers
|
||||
(Lighthouse, Screaming Frog) don't see `<meta description>` in the head → SEO drops.
|
||||
|
||||
**Z `generateStaticParams` trasa kompiluje się jako SSG (`●`)** → synchroniczny,
|
||||
kompletny `<head>` → SEO 100/100. To najsilniejsze rozwiązanie problemu
|
||||
metadata-w-head (mocniejsze niż samo ISR/htmlLimitedBots).
|
||||
**With `generateStaticParams` the route compiles as SSG (`●`)** → a synchronous,
|
||||
complete `<head>` → SEO 100/100. This is the strongest fix for the
|
||||
metadata-in-head problem (stronger than ISR/htmlLimitedBots alone).
|
||||
|
||||
Plugin dostarcza gotowy generateStaticParams przez createContentHelpers:
|
||||
The plugin provides a ready generateStaticParams through createContentHelpers:
|
||||
|
||||
```ts
|
||||
// lib/content.ts — dodaj do destrukturyzacji
|
||||
// lib/content.ts — add to the destructuring
|
||||
export const {
|
||||
getCachedPayload, getSettings, resolveRoute,
|
||||
generateStaticParams, // ← z pluginu
|
||||
generateStaticParams, // ← from the plugin
|
||||
sitemap, robots,
|
||||
} = createContentHelpers({ config, content: contentConfig, i18n: i18nConfig, baseUrl })
|
||||
|
||||
// app/(frontend)/[[...slug]]/page.tsx (albo [locale]/[[...slug]])
|
||||
// app/(frontend)/[[...slug]]/page.tsx (or [locale]/[[...slug]])
|
||||
export { generateStaticParams } from '@/lib/content'
|
||||
```
|
||||
|
||||
Helper automatycznie: pobiera **tylko kolekcję Pages** (`pagesSlug`), maks. **1000
|
||||
dokumentów na język** (`limit: 1000`, bez paginacji — nadmiar renderuje się na żądanie);
|
||||
stronę główną zamienia na root (`slug: []`); pomija drafty, stronę przypisaną jako 404
|
||||
oraz slugi `404`, `500`, `error`, `not-found`; zwraca `{slug}[]` (jednojęzyczny) albo
|
||||
`{locale, slug}[]` (wielojęzyczny). Obsługuje slugi wielopoziomowe (`a/b` → `['a','b']`)
|
||||
oraz zlokalizowane (string albo mapa per język).
|
||||
The helper automatically: fetches **only the Pages collection** (`pagesSlug`), at most **1000
|
||||
documents per language** (`limit: 1000`, no pagination — the rest render on demand);
|
||||
turns the home page into the root (`slug: []`); skips drafts, the page assigned as 404,
|
||||
and the slugs `404`, `500`, `error`, `not-found`; returns `{slug}[]` (single-language) or
|
||||
`{locale, slug}[]` (multi-language). It handles multi-level slugs (`a/b` → `['a','b']`)
|
||||
and localized ones (a string or a per-language map).
|
||||
|
||||
**Wpisy kolekcji `content` (`/pl/artykuly/moj-post`) i strony archiwów z paginacją NIE
|
||||
są generowane** (`src/modules/frontend/createContentHelpers.ts` ~514) — renderują się na
|
||||
żądanie przy pierwszym wejściu. Jeśli wpisy muszą być SSG, dopisz własny
|
||||
`generateStaticParams` łączący wynik helpera z wpisami.
|
||||
**Entries of the `content` collections (`/pl/artykuly/moj-post`) and paginated archive pages are NOT
|
||||
generated** (`src/modules/frontend/createContentHelpers.ts` ~514) — they render on
|
||||
demand on the first visit. If entries must be SSG, add your own
|
||||
`generateStaticParams` that combines the helper's result with the entries.
|
||||
|
||||
Baza niedostępna w buildzie (Docker/CI) → `[]` + ostrzeżenie w logu, build nie pada.
|
||||
Szczegóły: [frontend.md](./frontend.md#generatestaticparams--co-naprawdę-generuje).
|
||||
Database unavailable during the build (Docker/CI) → `[]` + a warning in the log, the build does not fail.
|
||||
Details: [frontend.md](./frontend.md#generatestaticparams--what-it-really-generates).
|
||||
|
||||
**Strony noindex SĄ renderowane** (nie pomijane jak w sitemap). Strona prawna
|
||||
(polityka, cookies) z noindex nadal musi się wyświetlić — użytkownik wchodzi z
|
||||
stopki, crawler czyta jej `<meta robots=noindex>`. noindex kontroluje
|
||||
INDEKSOWANIE, nie istnienie strony. Pominięcie wymusiłoby dynamiczne renderowanie
|
||||
(ten sam problem streamingu, którego unikamy).
|
||||
**noindex pages ARE rendered** (not skipped as in the sitemap). A legal page
|
||||
(policy, cookies) with noindex must still display — the user comes from the
|
||||
footer, the crawler reads its `<meta robots=noindex>`. noindex controls
|
||||
INDEXING, not whether the page exists. Skipping it would force dynamic rendering
|
||||
(the same streaming problem we avoid).
|
||||
|
||||
Helper NIE filtruje `_status` w zapytaniu (`where`) — kolekcje bez włączonych
|
||||
draftów nie mają tego pola i zapytanie by rzuciło błąd. Drafty odfiltrowane w
|
||||
pamięci (bezpieczne dla każdej kolekcji).
|
||||
The helper does NOT filter `_status` in the query (`where`) — collections without
|
||||
drafts turned on have no such field and the query would throw. Drafts are filtered out in
|
||||
memory (safe for any collection).
|
||||
|
||||
## PUŁAPKA: await searchParams deoptymalizuje ISR
|
||||
## TRAP: await searchParams de-optimizes ISR
|
||||
|
||||
W Next 15/16 `searchParams` to Promise. Odczyt `const { page } = await searchParams`
|
||||
w komponencie strony **deoptymalizuje ISR** — wymusza dynamiczne renderowanie dla
|
||||
tego requestu (traci cały zysk SSG/ISR + wraca problem metadata w body).
|
||||
In Next 15/16 `searchParams` is a Promise. Reading `const { page } = await searchParams`
|
||||
in a page component **de-optimizes ISR** — it forces dynamic rendering for
|
||||
that request (losing all the SSG/ISR gain + the metadata-in-body problem returns).
|
||||
|
||||
- **Strona BEZ paginacji** → NIE przekazuj/nie czytaj `searchParams` wcale:
|
||||
- **Page WITHOUT pagination** → do NOT pass/read `searchParams` at all:
|
||||
```ts
|
||||
export default async function Page({ params }) { // bez searchParams
|
||||
export default async function Page({ params }) { // no searchParams
|
||||
const { locale, slug } = await params
|
||||
const route = await resolveRoute(locale, slug ?? []) // bez page
|
||||
const route = await resolveRoute(locale, slug ?? []) // no page
|
||||
}
|
||||
```
|
||||
- **Strona Z paginacją** (archiwum) → czytaj searchParams, ale świadomie (ta trasa
|
||||
będzie dynamiczna). Rozważ osobną trasę dla archiwum z paginacją, żeby zwykłe
|
||||
strony zostały SSG.
|
||||
- **Page WITH pagination** (archive) → read searchParams, but deliberately (this route
|
||||
will be dynamic). Consider a separate route for the paginated archive, so regular
|
||||
pages stay SSG.
|
||||
|
||||
Reguła: `searchParams` tylko tam, gdzie NAPRAWDĘ potrzebujesz (paginacja). Wszędzie
|
||||
indziej pomiń — inaczej tracisz SSG i SEO.
|
||||
Rule: `searchParams` only where you REALLY need it (pagination). Everywhere
|
||||
else skip it — otherwise you lose SSG and SEO.
|
||||
|
||||
## Wyłączenie, nadpisanie, rozszerzenie
|
||||
## Turn off, override, extend
|
||||
|
||||
- Wyłączenie: pomiń opcję `pages` — znika tab System Pages i Under construction (a `content` przestaje działać).
|
||||
- `roles` ogranicza zestaw pól ról; etykiety i opisy pól są obecnie stałe (po angielsku).
|
||||
- Własnych ról nie da się dodać opcją `pages` — dodatkowe pola SiteSettings dajesz przez `siteSettingsFields` (tab „Custom”, payload-helpers.md), ale helpery (`getSystemPagePath`, `getSystemLinks`) wtedy czytasz ręcznie: `getSystemPagePath({ page: settings.mojaRola, … })`, `getSystemLinks(locale, ['mojaRola'])`.
|
||||
- 404: `createNotFoundPage` (`load` / `blocks` / `fallback` / `blockProps`) albo pełny własny `not-found.tsx` (wyżej).
|
||||
- Strona catch-all: `createPageRoute` z `render`, `onMissing`, `homeAlias: false` — albo własna strona na `resolveRoute`.
|
||||
- Turn off: omit the `pages` option — the System Pages and Under construction tabs disappear (and `content` stops working).
|
||||
- `roles` limits the set of role fields; field labels and descriptions are currently fixed (in English).
|
||||
- You cannot add your own roles with the `pages` option — add extra SiteSettings fields with `siteSettingsFields` (the "Custom" tab, payload-helpers.md), but then call the helpers (`getSystemPagePath`, `getSystemLinks`) by hand: `getSystemPagePath({ page: settings.myRole, … })`, `getSystemLinks(locale, ['myRole'])`.
|
||||
- 404: `createNotFoundPage` (`load` / `blocks` / `fallback` / `blockProps`) or a fully custom `not-found.tsx` (above).
|
||||
- Catch-all page: `createPageRoute` with `render`, `onMissing`, `homeAlias: false` — or your own page on `resolveRoute`.
|
||||
|
||||
Reference in New Issue
Block a user