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:
Radosław Smoliński
2026-10-19 19:38:28 +02:00
co-authored by Claude Opus 5.5
parent 46d30d4ecd
commit f809526f1d
31 changed files with 551 additions and 54 deletions
+26
View File
@@ -87,3 +87,29 @@ describe('noindex protection', () => {
expect(updated.noindex).toBe(true)
})
})
describe('content entries: own JSON-LD and links', () => {
test('pageJsonLd.entries replaces the article node; link options know the archives', async () => {
const { createContentHelpers } = await import('../src/modules/frontend/createContentHelpers.js')
const { buildProductJsonLd } = await import('../src/modules/seo/buildProductJsonLd.js')
const archive = await payload.create({ collection: 'pages' as never, data: { slug: 'wyroby', _status: 'published', title: 'Wyroby' } as never })
await payload.updateGlobal({ slug: 'site-settings' as never, data: { postsArchive: archive.id, siteName: 'Acme' } as never })
await payload.create({ collection: 'posts' as never, data: { slug: 'pierscionek', _status: 'published', title: 'Pierścionek' } as never })
const h = createContentHelpers({
baseUrl: 'https://acme.pl',
config: payload.config,
content: { collections: [{ slug: 'posts' }] },
i18n: { defaultLocale: 'pl', locales: [{ code: 'pl', label: 'Polski' }] },
pageJsonLd: {
entries: { posts: ({ doc, siteName, url }) => buildProductJsonLd({ name: String(doc.title), brand: siteName, url }) },
},
})
const nodes = await h.getPageJsonLd('pl', ['wyroby', 'pierscionek'])
expect(nodes.map((n) => n['@type'])).toEqual(['Product', 'BreadcrumbList'])
expect(nodes[0]).toMatchObject({ name: 'Pierścionek', brand: { name: 'Acme' } })
expect(nodes[0]).not.toHaveProperty('offers')
const options = await h.getLinkOptions('pl')
expect(options.archives).toEqual({ posts: 'wyroby' })
expect(await h.resolveLink({ type: 'internal', label: 'x', page: { relationTo: 'posts', value: { slug: 'pierscionek' } } }, 'pl')).toMatchObject({ href: '/pl/wyroby/pierscionek' })
})
})