seo — Optimization
Single sitemap file and 45,000-URL warning
Section titled “Single sitemap file and 45,000-URL warning”@nexload-sdk/seo generates a single sitemap.xml file. One sitemap file may contain at most 50,000 URLs: createSitemap logs seo.sitemap.size_warning once total emitted entries reach 45,000 URLs and does not split, and stops any individual source after 1,000 pages (treating that source as failed with seo.sitemap.source_failed). Split larger sites into several sitemap routes/sources yourself. Fault isolation ensures a failing source does not empty the rest of the sitemap; createSitemap throws only when every configured source fails.
Page-size guidance for sitemap sources
Section titled “Page-size guidance for sitemap sources”In your /api/seo/sitemap/:source endpoint, choose a balanced limit (such as limit: 100) so a source fits comfortably within the 1,000-page cap and 50,000-URL sitemap limit without triggering oversized single-page Payload queries. Avoid small limits like limit: 10 on large collections, and avoid limit: 5000 single-shot queries that risk timeouts.
Uncached reads vs. consumer revalidation
Section titled “Uncached reads vs. consumer revalidation”The default examples export export const dynamic = "force-dynamic" and fetch with { cache: "no-store" } so Next.js never prerenders stale SEO metadata, sitemap.xml, or robots.txt. If you cache CMS responses or pages for lower latency, revalidate the current document path, any historical redirect paths, /sitemap.xml, /robots.txt, and cached seo-settings reads on publish, unpublish, rename, and settings changes—pair with @nexload-sdk/payload-revalidate.
Deduplicate per-request route fetches
Section titled “Deduplicate per-request route fetches”In app/[...path]/page.tsx, both generateMetadata and the page component call /api/seo/route?path=... and /api/seo/settings. Wrap getSeoRoute and getSeoSettings in React cache() when using uncached fetches so a single page render performs one route lookup and one settings read per request.