diff --git a/apps/resources/app/sitemap.ts b/apps/resources/app/sitemap.ts index 258bb23e..e3cb5b44 100644 --- a/apps/resources/app/sitemap.ts +++ b/apps/resources/app/sitemap.ts @@ -1,5 +1,7 @@ import { MetadataRoute } from 'next'; import { getResources } from '../lib/resources'; +import { featureFlags } from 'lib/featureFlags'; +import { getCollections } from 'lib/collections'; export const dynamic = 'force-dynamic'; @@ -40,6 +42,24 @@ const sitemap = async (): Promise => { }); }); + const flags = await featureFlags(); + + if (flags.collections) { + pages.push({ + url: 'https://lifecentereddesign.net/collections', + lastModified: new Date(), + }); + + const collections = await getCollections(); + + collections.forEach((collection) => { + pages.push({ + url: `https://lifecentereddesign.net/collections/${collection.id}`, + lastModified: new Date(), + }); + }); + } + return pages; };