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:
co-authored by
Claude Opus 5.5
parent
d992d131a2
commit
3645e61f7d
+28
-1
@@ -352,6 +352,32 @@ LanguageSwitcher has NO styles (classNames) — not `variant="light|dark"`, so t
|
||||
fits any project design. A locale with no known alternate URL →
|
||||
falls back to the root `/{code}`.
|
||||
|
||||
**`renderLabel` needs a client wrapper.** `LanguageSwitcher` is a client component and `renderLabel` is a
|
||||
function; a server component (a header rendered on the server) cannot pass a function to a client
|
||||
component — `next build` fails ("Functions cannot be passed directly to Client Components"). Put the
|
||||
switcher with its `renderLabel` in a small client file of your own and render that from the server header:
|
||||
|
||||
```tsx
|
||||
// src/components/layout/LocaleSwitcher.tsx — a client component of your own
|
||||
'use client'
|
||||
import type { I18nConfig } from '@intecion/ipal-kit'
|
||||
import { LanguageSwitcher } from '@intecion/ipal-kit/client'
|
||||
|
||||
export function LocaleSwitcher({ config, locale }: { config: I18nConfig; locale: string }) {
|
||||
return (
|
||||
<LanguageSwitcher
|
||||
classNames={{ root: 'relative', trigger: '…', menu: '…', item: '…', itemActive: '…' }}
|
||||
config={config}
|
||||
currentLocale={locale}
|
||||
renderLabel={(l) => l.code.toUpperCase()}
|
||||
/>
|
||||
)
|
||||
}
|
||||
// header.tsx (server): <LocaleSwitcher config={i18nConfig} locale={locale} />
|
||||
```
|
||||
|
||||
Without `renderLabel` (the config labels) the server header can render `LanguageSwitcher` directly.
|
||||
|
||||
> **Where the page gets alternates:** the RSC page already resolves the route (resolveRoute);
|
||||
> from the same source compute the slugs per language (getLocalizedSlugs/buildLocalizedPath)
|
||||
> and pass them to AlternateLinksUpdater. This removes the custom AlternateLinksContext
|
||||
@@ -426,6 +452,7 @@ separate. The panel's language is what each user picks in *Account → Language*
|
||||
- `i18n` is required — the module cannot be turned off; one language = mode without the `/pl` prefix.
|
||||
- `config.localization` is currently always overridden from `i18n` (your own `localization` in payload.config does not survive); `fallback: false` turns off Payload's fallback.
|
||||
- Proxy: `createProxy` with options (`consentCategory`, `cookieName`, `exposeHeaders`, `markdown`, `policyVersion`) or your own proxy on `createLocaleMiddleware` + `negotiateLocale` / `matchAcceptLanguage`.
|
||||
- Switcher: `LanguageSwitcher` (`classNames`, `renderLabel`) or your own on `useAlternateLinks()`.
|
||||
- Switcher: `LanguageSwitcher` (`classNames`, `renderLabel` — only from a client component: wrap it, see
|
||||
"Language switcher without 404") or your own on `useAlternateLinks()`.
|
||||
- Paths: `buildLocalizedPath` / `switchLocalePath` with `homeSlug` and `prefix` — for your own link helpers.
|
||||
- Admin languages: your own `i18n.supportedLanguages` wins over the plugin's en + pl default; component texts via `i18n.translations.<lang>.ipal.<key>`.
|
||||
|
||||
Reference in New Issue
Block a user