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
@@ -14,9 +14,11 @@ export type ImagesConfig = {
|
||||
* - remotePatterns for the media domain (R2_PUBLIC_URL) so next/image may
|
||||
* optimize R2 files — otherwise it refuses them;
|
||||
* - optimized images cached for 31 days (uploads get new names when replaced);
|
||||
* - outside production, media served by the app itself (`/api/media/file/**` on
|
||||
* NEXT_PUBLIC_SERVER_URL — local disk, no R2), including localhost, which
|
||||
* Next 16 otherwise refuses as a private IP.
|
||||
* - media served by the app itself (`/api/media/file/**` on NEXT_PUBLIC_SERVER_URL —
|
||||
* local disk, no R2): always outside production, and in production whenever
|
||||
* R2_PUBLIC_URL is empty (Payload then gives absolute URLs on the site's own host,
|
||||
* which next/image refuses with 400 unless they are allowed); outside production
|
||||
* also localhost, which Next 16 otherwise refuses as a private IP.
|
||||
*
|
||||
* import { buildImagesConfig } from '@intecion/ipal-kit'
|
||||
* export default withPayload({ images: { ...buildImagesConfig(), /* your overrides *\/ } })
|
||||
@@ -39,7 +41,8 @@ export function buildImagesConfig({
|
||||
}
|
||||
for (const host of extraHosts) {remotePatterns.push({ hostname: host, protocol: 'https' })}
|
||||
let localMedia = false
|
||||
if (!production && serverUrl && /^https?:\/\//i.test(serverUrl)) {
|
||||
const r2 = remotePatterns.length > 0
|
||||
if ((!production || !r2) && serverUrl && /^https?:\/\//i.test(serverUrl)) {
|
||||
const u = new URL(serverUrl)
|
||||
remotePatterns.push({
|
||||
hostname: u.hostname,
|
||||
@@ -47,7 +50,7 @@ export function buildImagesConfig({
|
||||
...(u.port ? { port: u.port } : {}),
|
||||
pathname: '/api/media/file/**',
|
||||
})
|
||||
localMedia = /^(?:localhost|127\.|10\.|192\.168\.|\[::1\])/.test(u.hostname)
|
||||
localMedia = !production && /^(?:localhost|127\.|10\.|192\.168\.|\[::1\])/.test(u.hostname)
|
||||
}
|
||||
return {
|
||||
formats: ['image/avif', 'image/webp'],
|
||||
|
||||
Reference in New Issue
Block a user