From 995dbe1a5e715e4b35785c67d456a247344af51f Mon Sep 17 00:00:00 2001 From: nemanjam Date: Mon, 29 Jul 2024 08:31:48 +0200 Subject: [PATCH] add sitemap route --- src/components/BaseHead.astro | 2 +- src/constants/routes.ts | 2 ++ src/libs/integrations/sitemap.ts | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index d9030f9..3a4b322 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -82,7 +82,7 @@ const ogImageUrl = new URL(image, baseUrl); rel="sitemap" type="application/xml" title="Sitemap" - href={`${SITE_URL}/sitemap-index.xml`} + href={`${SITE_URL}${ROUTES.STATIC.SITEMAP}`} /> {/* Open Graph / Facebook */} diff --git a/src/constants/routes.ts b/src/constants/routes.ts index 0663b6a..7c21269 100644 --- a/src/constants/routes.ts +++ b/src/constants/routes.ts @@ -22,6 +22,8 @@ export const ROUTES = { STATIC: { IMAGES: '/images/', FAVICONS: '/images/favicons/', + /** generated at build-time only */ + SITEMAP: '/sitemap-index.xml', }, API: { OG_IMAGES: '/api/open-graph/', diff --git a/src/libs/integrations/sitemap.ts b/src/libs/integrations/sitemap.ts index 82cf1d3..b1bf593 100644 --- a/src/libs/integrations/sitemap.ts +++ b/src/libs/integrations/sitemap.ts @@ -5,6 +5,7 @@ import { ROUTES } from '../../constants/routes'; const { SITE_URL } = CONFIG; +/** generated at build-time only */ export const sitemapIntegration = () => sitemap({ serialize: (item) => {