From 720fb0cfbe94fd21475fdcfe93a35badae7aaf76 Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Sun, 8 Dec 2024 20:11:47 +0900 Subject: [PATCH] fix: feed link slug --- src/routes/blog/feed.xml/+server.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/routes/blog/feed.xml/+server.ts b/src/routes/blog/feed.xml/+server.ts index 9757c6ea..bf2b9786 100644 --- a/src/routes/blog/feed.xml/+server.ts +++ b/src/routes/blog/feed.xml/+server.ts @@ -26,9 +26,14 @@ export const GET = (async () => { if (!post.isPublished) { continue; } + const slug = post.filepath.split('/').at(-1)?.replace(/\.md$/, ''); + + if (slug == null) { + continue; + } feed.addItem({ - link: subdomain('blog', post.slug), + link: subdomain('blog', slug), date: new Date(post.pubDate), title: post.title, description: `${post.title} | ${post.readingTime.text}`,