Skip to content

Commit

Permalink
Add fallback if site isn't defined
Browse files Browse the repository at this point in the history
  • Loading branch information
zephraph committed Oct 4, 2024
1 parent fe8fb3d commit beb9e15
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pages/rss.xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand All @@ -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,
});
};

0 comments on commit beb9e15

Please sign in to comment.