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
+40
-40
@@ -1,15 +1,15 @@
|
||||
# slug
|
||||
|
||||
Pole slug generowane automatycznie z tytułu, per locale.
|
||||
A slug field generated automatically from the title, per locale.
|
||||
|
||||
> **Plugin JUŻ to ma — nie pisz własnego auto-sluga.** Częsty błąd: projekt
|
||||
> dodaje ręczne pole `{ name: 'slug', type: 'text' }` i każe redaktorowi wpisywać
|
||||
> slug, albo pisze własny hook normalizujący. Nie trzeba — `buildSlugField`
|
||||
> robi to lepiej: auto-generacja gdy puste, nie nadpisuje ręcznego, per-locale,
|
||||
> diakrytyki PL→ASCII. Jeśli w kolekcji masz ręczny slug, ZAMIEŃ go na
|
||||
> **The plugin ALREADY has this — don't write your own auto-slug.** A common mistake: the project
|
||||
> adds a manual field `{ name: 'slug', type: 'text' }` and makes the editor type the
|
||||
> slug, or writes its own normalizing hook. Not needed — `buildSlugField`
|
||||
> does it better: auto-generation when empty, never overwrites a manual one, per-locale,
|
||||
> PL diacritics → ASCII. If a collection has a manual slug, REPLACE it with
|
||||
> `buildSlugField({ from: 'title' })`.
|
||||
|
||||
## Użycie (kolekcja klienta)
|
||||
## Usage (client collection)
|
||||
|
||||
```ts
|
||||
import { buildSlugField } from '@intecion/ipal-kit'
|
||||
@@ -24,52 +24,52 @@ export const Pages: CollectionConfig = {
|
||||
}
|
||||
```
|
||||
|
||||
Zwraca gotowe pole: `slug`, text, `localized` (domyślnie), `required` (domyślnie),
|
||||
`index: true`, z hookiem `beforeValidate`. **Nie** ustawia `unique` — dwa dokumenty mogą
|
||||
mieć ten sam slug (routing weźmie pierwszy); unikalność dodaj przez `overrides`.
|
||||
Returns a ready field: `slug`, text, `localized` (default), `required` (default),
|
||||
`index: true`, with a `beforeValidate` hook. It does **not** set `unique` — two documents can
|
||||
have the same slug (routing takes the first); add uniqueness through `overrides`.
|
||||
|
||||
## Zachowanie
|
||||
## Behavior
|
||||
|
||||
Slug generuje się z pola źródłowego **tylko gdy jest pusty**. Wpis ręczny zostaje —
|
||||
także po zmianie tytułu — ale jest **normalizowany przez `toSlug`** (małe litery,
|
||||
diakrytyki → ASCII, znaki spoza `[a-z0-9-]` usuwane). Zmiana adresu opublikowanej
|
||||
strony to zerwane linki, więc plugin nigdy nie robi tego sam.
|
||||
The slug is generated from the source field **only when it is empty**. A manual entry stays —
|
||||
also after the title changes — but it is **normalized by `toSlug`** (lowercase,
|
||||
diacritics → ASCII, characters outside `[a-z0-9-]` removed). Changing the URL of a published
|
||||
page breaks links, so the plugin never does it by itself.
|
||||
|
||||
**Uwaga — slugi wielopoziomowe:** `toSlug` usuwa `/`, więc `uslugi/biznesowe` wpisane
|
||||
w to pole zapisze się jako `uslugibiznesowe` (`src/modules/slug/buildSlugField.ts`).
|
||||
Routing (`resolveRoute`, `generateStaticParams`) obsługuje slugi z `/`, ale nie da się
|
||||
ich wprowadzić przez `buildSlugField` — potrzebne własne pole/hook (`overrides.hooks`).
|
||||
**Note — multi-level slugs:** `toSlug` removes `/`, so `uslugi/biznesowe` typed
|
||||
into this field is saved as `uslugibiznesowe` (`src/modules/slug/buildSlugField.ts`).
|
||||
Routing (`resolveRoute`, `generateStaticParams`) handles slugs with `/`, but you cannot
|
||||
enter them through `buildSlugField` — you need your own field/hook (`overrides.hooks`).
|
||||
|
||||
Diakrytyki idą przez `slugify`: „Strona główna" → `strona-glowna`.
|
||||
Diacritics go through `slugify`: "Strona główna" → `strona-glowna`.
|
||||
|
||||
## Per locale
|
||||
|
||||
Slug jest zlokalizowany — każdy język ma własny. Edytując w PL ustawiasz
|
||||
`slug.pl`, w EN `slug.en`.
|
||||
The slug is localized — each language has its own. Editing in PL sets
|
||||
`slug.pl`, in EN `slug.en`.
|
||||
|
||||
**Konsekwencja:** slug generuje się tylko dla locale, w którym wypełniono tytuł.
|
||||
Utworzysz stronę po polsku, przełączysz front na `/en/…` — 404, bo `slug.en`
|
||||
jest puste. Trzeba przełączyć locale w adminie i wpisać tytuł po angielsku.
|
||||
**Consequence:** the slug is generated only for the locale in which the title was filled in.
|
||||
Create a page in Polish, switch the front end to `/en/…` — 404, because `slug.en`
|
||||
is empty. Switch the locale in the admin panel and type the title in English.
|
||||
|
||||
To ta sama mapa slugów, z której powstają hreflang alternates (patrz seo.md) i
|
||||
przełącznik języka (patrz i18n.md).
|
||||
It is the same slug map that hreflang alternates (see seo.md) and the
|
||||
language switcher (see i18n.md) are built from.
|
||||
|
||||
## Opcje
|
||||
## Options
|
||||
|
||||
```ts
|
||||
buildSlugField({
|
||||
from: 'title', // pole źródłowe (domyślnie 'title')
|
||||
name: 'slug', // nazwa pola (domyślnie 'slug')
|
||||
required: true, // domyślnie true
|
||||
localized: true, // domyślnie true
|
||||
overrides: {}, // Partial<TextField> — rozlewane NA KOŃCU pola
|
||||
from: 'title', // source field (default 'title')
|
||||
name: 'slug', // field name (default 'slug')
|
||||
required: true, // default true
|
||||
localized: true, // default true
|
||||
overrides: {}, // Partial<TextField> — spread LAST onto the field
|
||||
})
|
||||
```
|
||||
|
||||
`overrides` nadpisuje wszystko, także `hooks` (podanie `overrides.hooks` usuwa
|
||||
auto-generację, chyba że dołożysz ją sam) i `admin` (`admin` jest scalane z opisem).
|
||||
`overrides` overrides everything, including `hooks` (passing `overrides.hooks` removes
|
||||
auto-generation unless you add it back yourself) and `admin` (`admin` is merged with the description).
|
||||
|
||||
## Pomocnicze
|
||||
## Helpers
|
||||
|
||||
```ts
|
||||
import { toSlug } from '@intecion/ipal-kit'
|
||||
@@ -77,8 +77,8 @@ import { toSlug } from '@intecion/ipal-kit'
|
||||
toSlug('Strona główna') // 'strona-glowna'
|
||||
```
|
||||
|
||||
## Wyłączenie, nadpisanie, rozszerzenie
|
||||
## Turn off, override, extend
|
||||
|
||||
- Moduł nie ma opcji w `ipalKit()` — pole dodajesz sam; wyłączenie = zwykłe pole `text` zamiast `buildSlugField`.
|
||||
- Nadpisanie: `name`, `from`, `required`, `localized`, `overrides` (np. `{ unique: true }`, własne `admin`, własne `hooks`).
|
||||
- Reguły normalizacji (`slugify` z `lower`, `strict`, `trim`) są obecnie stałe — inny format wymaga własnego hooka; `toSlug` możesz użyć jako klocka.
|
||||
- The module has no option in `ipalKit()` — you add the field yourself; turning off = a plain `text` field instead of `buildSlugField`.
|
||||
- Override: `name`, `from`, `required`, `localized`, `overrides` (e.g. `{ unique: true }`, your own `admin`, your own `hooks`).
|
||||
- The normalization rules (`slugify` with `lower`, `strict`, `trim`) are currently fixed — a different format needs your own hook; you can use `toSlug` as a building block.
|
||||
|
||||
Reference in New Issue
Block a user