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
@@ -251,6 +251,33 @@ describe('sitemap route: split, cache, errors', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('system pages without a URL of their own', () => {
|
||||
const settings = { homepage: { id: 1, slug: { en: 'home', pl: 'start' } }, notFound: { id: 2, slug: { en: 'not-found-page', pl: 'nie-znaleziono' } } }
|
||||
const pages = [
|
||||
{ id: 1, slug: { en: 'home', pl: 'start' }, _status: 'published', title: 'Home' },
|
||||
{ id: 2, slug: { en: 'not-found-page', pl: 'nie-znaleziono' }, _status: 'published', title: 'Not found' },
|
||||
{ id: 3, slug: { en: 'contact', pl: 'kontakt' }, _status: 'published', title: 'Contact' },
|
||||
]
|
||||
|
||||
test('the assigned 404 page is left out of the sitemap, the site index and llms.txt', async () => {
|
||||
const payload = fakePayload({ pages })
|
||||
payload.findGlobal.mockResolvedValue(settings)
|
||||
const sitemap = await buildSitemapEntries({ baseUrl: 'https://acme.pl', config, payload: payload as never })
|
||||
expect(sitemap.map((e) => e.url)).toEqual(['https://acme.pl/pl', 'https://acme.pl/en', 'https://acme.pl/pl/kontakt', 'https://acme.pl/en/contact'])
|
||||
|
||||
const flat = fakePayload({ pages: pages.map((p) => ({ ...p, slug: p.slug.pl })) })
|
||||
flat.findGlobal.mockResolvedValue(settings)
|
||||
expect((await collectSiteIndex({ config: single, payload: flat as never })).map((e) => e.path)).toEqual(['/', '/kontakt'])
|
||||
expect(await buildLlmsTxt({ baseUrl: 'https://acme.pl', config: single, payload: flat as never })).not.toContain('nie-znaleziono')
|
||||
})
|
||||
|
||||
test('a 404 page that is also the homepage stays listed', async () => {
|
||||
const payload = fakePayload({ pages: pages.slice(0, 1) })
|
||||
payload.findGlobal.mockResolvedValue({ homepage: { id: 1 }, notFound: 1 })
|
||||
expect(await buildSitemapEntries({ baseUrl: 'https://acme.pl', config, payload: payload as never })).toHaveLength(2)
|
||||
})
|
||||
})
|
||||
|
||||
describe('collectSiteIndex and llms.txt', () => {
|
||||
const pages = Array.from({ length: 1205 }, (_, i) => ({ id: i, slug: `p${i}`, title: `Page ${i}` }))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user