feat(sitemap): update base URL and add build environment handling

Change the base URL from localhost to the production URL. 
Implement a check for the build environment to use mock data 
for generating the sitemap during the build process. 
This ensures that sitemap is correctly populated 
with project routes even when the API is not available.
This commit is contained in:
2025-02-12 17:58:59 +01:00
parent bcd25ef751
commit 44589b5bbd
3 changed files with 30 additions and 4 deletions

View File

@@ -15,9 +15,9 @@ interface SitemapRoute {
}
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const baseUrl = "http://localhost:3000";
const baseUrl = "https://dki.one";
// Fetch the sitemap data from the dynamic API route
// Fetch the sitemap data from the dynamic API routes
const response = await fetch(`${baseUrl}/api/sitemap`);
if (!response.ok) {
throw new Error(`Failed to fetch sitemap: ${response.statusText}`);