Page-filled form fields, links to entries, entry JSON-LD, R2-optional dev
Forms: `values` on RenderForm / BuilderForm / useBuilderForm fills fields the
page knows (chosen product variant, category) — read-only <output>, in the
SSR HTML, sent and validated like any field. prepareBuilderForm (/rsc) is the
server half of RenderForm for client components whose values change in the
browser; publicForm is exported so projects stop copying it.
Links: buildLinkField({ relationTo: ['pages', 'categories', …] }) — a
polymorphic relation; resolveLinkHref builds /{locale}/{archive}/{entry} from
`archives`, which getLinkOptions in createContentHelpers fills from Site
Settings.
SEO: pageJsonLd.entries — the main JSON-LD node per content collection
instead of BlogPosting; buildProductJsonLd emits an Offer only for a real
price from the panel.
Pages: createPageRoute / createNotFoundPage pass isFirst to blocks, so the
first section carries the page's only h1.
Fixes: ipalEnvRules({ storage: true }) requires R2_* in production only
(development: optional, all or none); buildImagesConfig allows the app's own
media on localhost outside production.
Docs, CHANGELOG, PROGRAMISTA §6 (34–37), ipal-form and ipal-upgrade skills.
Tests: builderForm, links, drafts (entries + archives), seo, media, env.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
46d30d4ecd
commit
f809526f1d
@@ -117,6 +117,32 @@ po przecinku (pusto = gdy tamto pole jest wypełnione / zaznaczone). Puste `fiel
|
||||
- Nowa grupa = kolumny `show_when_field` / `show_when_values` w tabelach bloków formularzy →
|
||||
po aktualizacji wygeneruj migrację (`payload migrate:create`).
|
||||
|
||||
### Wartości pól ze strony (`values`, 1.11.0)
|
||||
Strona zna wartość pola, której nie wpisuje odwiedzający — wybrany wariant produktu, kategorię, ofertę.
|
||||
Redaktor dodaje w formularzu zwykłe pole tekstowe (np. `subject`, „Dotyczy”), a strona je wypełnia:
|
||||
|
||||
```tsx
|
||||
// wartość znana na serwerze (kategoria „wkrótce”)
|
||||
<RenderForm form={form} action={sendForm} locale={locale} texts={formTexts} values={{ subject: category.title }} />
|
||||
```
|
||||
Pole z `values` jest pokazane tylko do odczytu (`<output>`, klasa `classNames.fixed`, `data-ipal="form-fixed"`),
|
||||
wysyłane jak każde inne i walidowane przez serwer według definicji z panelu. Nazwy spoza formularza są pomijane.
|
||||
Wartość jest w pierwszym HTML (SSR), nie dopiero po hydracji.
|
||||
|
||||
Wartość zmieniana w przeglądarce (konfigurator): serwer przygotowuje formularz `prepareBuilderForm` (`/rsc`) —
|
||||
publiczną część (`publicForm`, bez zakładki Emails), wyrenderowane bloki message i potwierdzenie, akcję przypiętą
|
||||
do formularza i języka, cel przekierowania — a komponent kliencki renderuje `BuilderForm` z aktualnym `values`:
|
||||
|
||||
```tsx
|
||||
// serwer
|
||||
const form = prepareBuilderForm({ form: catalog.inquiryForm, action: sendForm, locale })
|
||||
<Configurator form={form} texts={formTexts} />
|
||||
// klient ('use client')
|
||||
<BuilderForm {...form} texts={texts} classNames={formClasses} values={{ subject: chosenVariant }} />
|
||||
```
|
||||
`publicForm(form)` (`/rsc`) — sama publiczna część dokumentu, gdy budujesz własny przekaz do klienta. Nigdy nie
|
||||
przekazuj do przeglądarki surowego dokumentu formularza.
|
||||
|
||||
### Formularz nietypowy — bez kopiowania silnika
|
||||
1. `renderField` (BuilderForm w pliku `'use client'`) — podmienia wybrane pola:
|
||||
`renderField={({ field, defaultRender }) => field.name === 'budget' ? <Cards …/> : undefined}`.
|
||||
|
||||
Reference in New Issue
Block a user