diff --git a/app/sitemap.ts b/app/sitemap.ts index f6af812b..0221f004 100644 --- a/app/sitemap.ts +++ b/app/sitemap.ts @@ -21,10 +21,12 @@ export default async function sitemap(): Promise { // Exclude any stories with noindex set to true on Storyblok const indexStories = response.filter((story) => !story.content?.noindex); - + const currentURL = process.env.URL || process.env.DEPLOY_PRIME_URL || 'https://momentum.stanford.edu'; + const ret = indexStories.map((story) => { + const url = story.path ? `${currentURL}/${story.path}` : `${currentURL}/${story.full_slug}`; return { - url: story.path ?? `/${story.full_slug}`, + url: url.replace(/\/+$/, ''), lastModified: new Date(story.published_at), changeFrequency: 'daily', // Added in 13.4.5 priority: 0.5, // Added in 13.4.5