diff options
| author | Hayden Bleasel <hello@haydenbleasel.com> | 2025-07-24 14:41:34 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-25 00:41:34 +0300 |
| commit | 5931ddb77aac23ffe1b82d9d7c03afde3e671109 (patch) | |
| tree | 3e2ead9cc6e13c01132a78c21b64f2be7b00e215 /apps/web/src/app/rss.xml/route.ts | |
| parent | 7b840e9b4e198212eb34861c21469b2215157914 (diff) | |
| download | opencut-5931ddb77aac23ffe1b82d9d7c03afde3e671109.tar.gz | |
feat: add ultracite (#452)
* Init ultracite
* Update scripts and biome.jsonc
* Update biome.jsonc
* Update biome.jsonc
* Update biome.jsonc
* Run format
Diffstat (limited to 'apps/web/src/app/rss.xml/route.ts')
| -rw-r--r-- | apps/web/src/app/rss.xml/route.ts | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/apps/web/src/app/rss.xml/route.ts b/apps/web/src/app/rss.xml/route.ts index 1ed63994..ab645655 100644 --- a/apps/web/src/app/rss.xml/route.ts +++ b/apps/web/src/app/rss.xml/route.ts @@ -1,33 +1,33 @@ -import { Feed } from 'feed'; -import { getPosts } from '@/lib/blog-query'; -import { SITE_INFO, SITE_URL } from '@/constants/site'; +import { Feed } from "feed"; +import { getPosts } from "@/lib/blog-query"; +import { SITE_INFO, SITE_URL } from "@/constants/site"; export async function GET() { try { const { posts } = await getPosts(); - + const feed = new Feed({ title: `${SITE_INFO.title} Blog`, description: SITE_INFO.description, id: `${SITE_URL}`, link: `${SITE_URL}/blog/`, - language: 'en', + language: "en", image: `${SITE_INFO.openGraphImage}`, favicon: `${SITE_INFO.favicon}`, copyright: `All rights reserved ${new Date().getFullYear()}, ${ SITE_INFO.title }`, }); - + for (const post of posts) { feed.addItem({ - title: post.title, - id: `${SITE_URL}/blog/${post.slug}`, - link: `${SITE_URL}/blog/${post.slug}`, - description: post.description, - author: post.authors.map((author) => ({ - name: author.name, - })), + title: post.title, + id: `${SITE_URL}/blog/${post.slug}`, + link: `${SITE_URL}/blog/${post.slug}`, + description: post.description, + author: post.authors.map((author) => ({ + name: author.name, + })), date: new Date(post.publishedAt), image: post.coverImage || SITE_INFO.openGraphImage, }); @@ -35,12 +35,12 @@ export async function GET() { return new Response(feed.rss2(), { headers: { - 'Content-Type': 'text/xml', - 'Cache-Control': 'public, max-age=86400, stale-while-revalidate', + "Content-Type": "text/xml", + "Cache-Control": "public, max-age=86400, stale-while-revalidate", }, }); } catch (error) { - console.error('Error generating RSS feed', error); - return new Response('Internal Server Error', { status: 500 }); + console.error("Error generating RSS feed", error); + return new Response("Internal Server Error", { status: 500 }); } -}
\ No newline at end of file +} |
