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
+10 -3
View File
@@ -1,6 +1,6 @@
---
name: ipal-seo-check
description: Checks a running ipal-kit site the way Googlebot and AI agents see it — metadata inside <head> (not streamed to body), title, description, self canonical, hreflang with x-default, noindex pages leaking into the sitemap, error pages in the sitemap, robots.txt, soft 404s, favicon, JSON-LD, and GEO (llms.txt, llms-full.txt, Markdown version, text/markdown alternate, MCP server, AI bots in robots, health). Use after building pages, before handing over, after deploys, after an ipal-kit upgrade, and whenever SEO, indexing, Search Console or "Google doesn't see" problems come up.
description: Checks a running ipal-kit site the way Googlebot and AI agents see it — metadata inside <head> (not streamed to body), title, description, self canonical, hreflang with x-default, noindex pages leaking into the sitemap, error pages in the sitemap, sitemap index parts, Search Console / Bing verification tags, robots.txt, soft 404s, favicon, JSON-LD, and GEO (llms.txt, llms-full.txt, Markdown version, text/markdown alternate, MCP server, AI bots in robots, health). Use after building pages, before handing over, after deploys, after an ipal-kit upgrade, and whenever SEO, indexing, Search Console or "Google doesn't see" problems come up.
---
# ipal-seo-check
@@ -31,11 +31,18 @@ Sprawdza **działającą** aplikację, nie kod — dokładnie to, co dostaje Goo
| no JSON-LD structured data | brak `<SiteProviders>` / `<JsonLdGraph>` w `[locale]/layout.tsx` albo pusta nazwa w Site Settings |
| `/llms.txt` / `/llms-full.txt` → 404 | brak trasy (`export { llmsRoute as GET }` / `llmsFullRoute` z `lib/content`) |
| Markdown version `/md/…` → 404 | brak `src/app/md/[locale]/[[...slug]]/route.ts`; strona noindex/draft |
| `sitemap.xml → 503` | baza niedostępna przy budowaniu sitemapy (`sitemapRoute` zwraca 503 + Retry-After zamiast pustej) — sprawdź `DATABASE_URL` / zdrowie bazy |
| sitemap index parts not 200 | serwis > `maxUrls` (10 000) → `/sitemap.xml` to index; części `?part=N` muszą odpowiadać 200 — własna trasa bez obsługi `part` albo cache CDN ze starą liczbą części |
| MCP not answering initialize | brak `src/app/api/mcp/route.ts` albo Cloudflare Access bez Bypass (mcp.md) |
3. `[WARNING]` oceń: brak opisu / zduplikowane tytuły to **treść w panelu** —
3. `no search-console verification meta tag` (WARNING) — wklej kod w **Site Settings →
Search & AI** (Google Search Console, Bing Webmaster). Weryfikacja przez DNS → dopisz
`verification` do `ipal-audit-skip:` w `AGENTS.md`.
`robots.txt blocks AI bots` — sprawdź też Site Settings → Search & AI → AI crawlers
(gdy projekt używa `getRobots`, redaktor mógł zmienić politykę).
4. `[WARNING]` oceń: brak opisu / zduplikowane tytuły to **treść w panelu** —
uzupełnij z briefu albo wypisz w raporcie dla klienta.
4. Uruchom ponownie aż `0 error(s)`.
5. Uruchom ponownie aż `0 error(s)`.
## Czego skrypt nie sprawdzi
Search Console (indeksacja, ręczne działania), Core Web Vitals, poprawność
@@ -73,14 +73,30 @@ else {
const sitemap = await get('/sitemap.xml')
let urls = []
let hasAlternates = false
if (sitemap.res.status !== 200) report('ERROR', `sitemap.xml → ${sitemap.res.status}`, 'export sitemap from lib/content + force-dynamic')
const locs = (xml) => [...xml.matchAll(/<loc>\s*([^<\s]+)\s*<\/loc>/g)].map((m) => m[1].replace(/&amp;/g, '&'))
if (sitemap.res.status === 503) report('ERROR', 'sitemap.xml → 503', 'the database was unreachable while building it (sitemapRoute answers 503 + Retry-After) — check DATABASE_URL / DB health')
else if (sitemap.res.status !== 200) report('ERROR', `sitemap.xml → ${sitemap.res.status}`, 'export sitemapRoute (or sitemap) from lib/content + force-dynamic')
else {
urls = [...new Set([...sitemap.text.matchAll(/<loc>\s*([^<\s]+)\s*<\/loc>/g)].map((m) => m[1]))]
hasAlternates = /hreflang=/.test(sitemap.text)
let xml = sitemap.text
// Large sites: /sitemap.xml is a <sitemapindex> of parts (?part=N) — read every part.
if (/<sitemapindex/i.test(xml)) {
const parts = locs(xml)
const broken = []
xml = ''
for (const part of parts.slice(0, 50)) {
const r = await get(part).catch(() => null)
if (!r || r.res.status !== 200) broken.push(`${part} → ${r?.res.status ?? 'unreachable'}`)
else xml += r.text
}
console.log(`sitemap index: ${parts.length} part(s)`)
if (broken.length) report('ERROR', 'sitemap index parts not 200', 'every <sitemap><loc> must answer 200 (seo.md → Duży serwis)', broken)
}
urls = [...new Set(locs(xml))]
hasAlternates = /hreflang=/.test(xml)
if (urls.length === 0) report('ERROR', 'sitemap.xml is empty', 'DB unreachable at build without force-dynamic, or no published pages')
const foreign = urls.filter((u) => !u.startsWith('http') || /localhost|127\.0\.0\.1/.test(u) !== /localhost|127\.0\.0\.1/.test(origin))
if (foreign.length) report('ERROR', 'sitemap URLs relative or on another host', 'NEXT_PUBLIC_SERVER_URL / baseUrl', foreign.slice(0, 5))
if (/(\/404|\/500|not-found)(\/|<|$)/.test(sitemap.text)) report('ERROR', 'error pages listed in the sitemap', 'pages.md — 404 page is excluded by ID')
if (/(\/404|\/500|not-found)(\/|<|$)/.test(xml)) report('ERROR', 'error pages listed in the sitemap', 'pages.md — 404 page is excluded by ID')
}
// --- 4. sampled pages -----------------------------------------------------
@@ -209,6 +225,16 @@ if (issues.noLinks.length) report('WARNING', 'pages without internal links', 'li
if (!skipped('jsonld') && issues.jsonLd.length) report('ERROR', 'no JSON-LD structured data', '<JsonLdGraph> WebSite + Organization in [locale]/layout.tsx (AGENT.md §0b.4)', issues.jsonLd.slice(0, 5))
if (!skipped('markdown') && issues.mdAlt.length) report('WARNING', 'no text/markdown alternate link in head', 'createContentHelpers({ markdownAlternate: true }) (AGENT.md §0b.6)', issues.mdAlt.slice(0, 3))
// --- 4b. Search Console / Bing verification (Site Settings → Search & AI) ----
if (!skipped('verification') && sample.length) {
const page = await get(sample[0]).catch(() => null)
const head = page?.text.split(/<\/head>/i)[0] ?? ''
const missing = [['google-site-verification', 'Google Search Console'], ['msvalidate.01', 'Bing Webmaster Tools']]
.filter(([name]) => !new RegExp(`<meta[^>]+name="${name}"`, 'i').test(head))
.map(([, label]) => label)
if (missing.length) report('WARNING', 'no search-console verification meta tag', 'paste the code in Site Settings → Search & AI (or verify by DNS and add `verification` to ipal-audit-skip)', missing)
}
// --- 5. 404 ---------------------------------------------------------------
const firstLocale = [...byLocale.keys()].find((l) => l && l.length <= 5) ?? ''
for (const path of [`/${firstLocale ? firstLocale + '/' : ''}ipal-seo-check-${Date.now()}`]) {