Skip to content

Commit

Permalink
Add Collections to Sitemap (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
timoclsn authored Oct 28, 2023
1 parent 1e950ac commit a50465b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions apps/resources/app/sitemap.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -40,6 +42,24 @@ const sitemap = async (): Promise<MetadataRoute.Sitemap> => {
});
});

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;
};

Expand Down

1 comment on commit a50465b

@vercel
Copy link

@vercel vercel bot commented on a50465b Oct 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.