From beb9e15cdfbe1b044be9c6903cc2c3a9537b0934 Mon Sep 17 00:00:00 2001 From: Justin Bennett Date: Thu, 3 Oct 2024 20:58:11 -0400 Subject: [PATCH] Add fallback if site isn't defined --- src/pages/rss.xml.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/rss.xml.ts b/src/pages/rss.xml.ts index 3bbf40c..e0a26ca 100644 --- a/src/pages/rss.xml.ts +++ b/src/pages/rss.xml.ts @@ -8,6 +8,8 @@ export const GET: APIRoute = async (context) => { include: ["customMetadata"], }); + const site = context.locals.runtime.env.SITE ?? "https://just-be.dev"; + const items: RSSFeedItem[] = pages .filter( (page) => @@ -23,13 +25,13 @@ export const GET: APIRoute = async (context) => { page.customMetadata?.updated ? new Date(page.customMetadata?.updated) : new Date(page.customMetadata?.published!), - link: `${context.locals.runtime.env.SITE}/${page.customMetadata?.slug}`, + link: `${site}/${page.customMetadata?.slug}`, })); return rss({ title: "Just Be", description: "The personal site of Justin Bennett", - site: context.locals.runtime.env.SITE, + site, items, }); };