From 483d6afbaba4414de4c051a9411135997c225f07 Mon Sep 17 00:00:00 2001 From: Scotty Waggoner Date: Wed, 15 May 2024 13:53:56 -0700 Subject: [PATCH] Include dynamically rendered pages in sitemap Add staticRoutes to allKeys in createUrlSet --- packages/next-sitemap/src/builders/url-set-builder.ts | 2 ++ packages/next-sitemap/src/interface.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/packages/next-sitemap/src/builders/url-set-builder.ts b/packages/next-sitemap/src/builders/url-set-builder.ts index d870dc41..45d44d36 100644 --- a/packages/next-sitemap/src/builders/url-set-builder.ts +++ b/packages/next-sitemap/src/builders/url-set-builder.ts @@ -74,6 +74,8 @@ export class UrlSetBuilder { ? Object.keys(this.manifest?.preRender?.routes ?? {}) : []), ...(this.manifest?.staticExportPages ?? []), + ...(this.manifest?.routes?.staticRoutes?.map((route) => route?.page) ?? + []), ] // Filter out next.js internal urls and generate urls based on sitemap diff --git a/packages/next-sitemap/src/interface.ts b/packages/next-sitemap/src/interface.ts index 403ad1be..e8e212c6 100644 --- a/packages/next-sitemap/src/interface.ts +++ b/packages/next-sitemap/src/interface.ts @@ -197,6 +197,7 @@ export interface IRoutesManifest { locales: string[] defaultLocale: string } + staticRoutes?: { page: string }[] } export interface IExportMarker {