Fixes from the reference site: 404 page unlisted, own-origin media, fillGlobal defaults, switcher docs

- sitemap, llms.txt and the site index leave out the page assigned as the 404
  page (unlistedPageIds, exported); it stays when it is also the homepage
- buildImagesConfig: in production with R2_PUBLIC_URL empty, allow the site's
  own /api/media/file/** so next/image no longer answers 400
- fillGlobal: a choice field (select, radio, checkbox, number, date) still at its
  defaultValue counts as empty; text is never overwritten
- docs: LanguageSwitcher renderLabel needs a 'use client' wrapper (i18n.md,
  ipal-site, ipal-setup, api.md)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-29 15:29:07 +01:00
co-authored by Claude Opus 5.5
parent d992d131a2
commit 3645e61f7d
19 changed files with 171 additions and 18 deletions
+1
View File
@@ -2,3 +2,4 @@ export { getSystemPagePath } from './getSystemPagePath.js'
export { buildSystemPagesFields } from './systemPagesFields.js'
export type { PagesOption, SystemPageRole } from './types.js'
export { ALL_SYSTEM_PAGE_ROLES } from './types.js'
export { unlistedPageIds } from './unlistedPages.js'
+21
View File
@@ -0,0 +1,21 @@
/** A relationship value (populated or an id) → its id. */
const idOf = (rel: unknown): number | string | undefined => {
if (typeof rel === 'string' || typeof rel === 'number') {return rel}
if (rel && typeof rel === 'object') {
const id = (rel as { id?: unknown }).id
return typeof id === 'string' || typeof id === 'number' ? id : undefined
}
return undefined
}
/**
* Pages that have no URL of their own, from Site settings → System pages: the page assigned as the
* 404 page renders through not-found.tsx and answers 404 at its own address, so the sitemap, llms.txt
* and the site index leave it out. A 404 page that is also the homepage stays listed.
*/
export function unlistedPageIds(settings: null | Record<string, unknown> | undefined): Set<number | string> {
const ids = new Set<number | string>()
const notFound = idOf(settings?.notFound)
if (notFound !== undefined && notFound !== idOf(settings?.homepage)) {ids.add(notFound)}
return ids
}