SEO: project overrides (sitemapEntries, sitemapOptions, underConstructionSeo, searchSettings fn); seo-check follows sitemap index

- createContentHelpers: sitemapEntries transform has the last word,
  sitemapOptions passes maxUrls/cacheControl/memoSeconds to sitemapRoute,
  underConstructionSeo: false turns the construction filter off
- seo.searchSettings accepts a function over the default fields
- ipal-seo-check: reads sitemap index parts, reports 503 sitemap, warns on
  missing Google/Bing verification (skip key: verification)
- docs/seo.md updated

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-22 17:13:57 +02:00
co-authored by Claude Opus 5.5
parent 94e563055f
commit dc761164d9
8 changed files with 117 additions and 18 deletions
+14
View File
@@ -71,6 +71,18 @@ describe('SEO outputs against a real database', () => {
expect(await urls()).toEqual(['https://acme.pl/en', 'https://acme.pl/en/about', 'https://acme.pl/pl', 'https://acme.pl/pl/o-nas'])
})
test('project overrides: sitemapEntries has the last word', async () => {
const h = createContentHelpers({
baseUrl: 'https://acme.pl',
config: configPromise,
i18n,
sitemapEntries: (entries) => [...entries.filter((e) => !e.url.endsWith('/en')), { url: 'https://acme.pl/custom' }],
})
const list = (await h.sitemap()).map((e) => e.url)
expect(list).toContain('https://acme.pl/custom')
expect(list).not.toContain('https://acme.pl/en')
})
test('verification codes and AI crawler rules from Site Settings → Search & AI', async () => {
await payload.updateGlobal({
slug: 'site-settings' as never,
@@ -98,6 +110,8 @@ describe('SEO outputs against a real database', () => {
expect(await urls()).toEqual(['https://acme.pl/en', 'https://acme.pl/pl'])
const llms = await (await helpers().llmsRoute()).text()
expect(llms).not.toContain('o-nas')
const unfiltered = createContentHelpers({ baseUrl: 'https://acme.pl', config: configPromise, i18n, underConstructionSeo: false })
expect(await unfiltered.sitemap()).toHaveLength(4)
await payload.updateGlobal({ slug: 'site-settings' as never, data: { construction: { enabled: false } } as never, locale: 'pl' as never })
expect(await urls()).toHaveLength(4)
})
+9
View File
@@ -307,5 +307,14 @@ describe('plugin: Search & AI tab', () => {
twoFactor: false,
})(base())
expect(tabs(off)).not.toContain('Search & AI')
const custom = await ipalKit({
access: { authCollection: 'users' },
i18n: config,
seo: { collections: [], searchSettings: (fields) => fields.filter((f) => 'name' in f && f.name !== 'llmsIntro') },
twoFactor: false,
})(base())
const settings = custom.globals?.find((g) => g.slug === 'site-settings')
const tab = (settings?.fields[0] as { tabs: { fields: { name?: string }[]; label: string }[] }).tabs.find((t) => t.label === 'Search & AI')
expect(tab?.fields.map((f) => f.name)).toEqual(['searchVerification', 'aiCrawlers'])
})
})