summaryrefslogtreecommitdiff
path: root/apps/web/src/app/rss.xml
diff options
context:
space:
mode:
authorKha Nguyen <hi@khanguyen.com>2025-07-24 16:50:14 -0500
committerKha Nguyen <hi@khanguyen.com>2025-07-24 16:50:14 -0500
commit262a7d53d63cc9997f730c7f64b7f8ec29723926 (patch)
tree894d6e3986b3ca339dc3ff7ec62fb31b3690be82 /apps/web/src/app/rss.xml
parent5a7745f806edf4a386b8cfd079861f96c3b92baf (diff)
parent5931ddb77aac23ffe1b82d9d7c03afde3e671109 (diff)
downloadopencut-262a7d53d63cc9997f730c7f64b7f8ec29723926.tar.gz
Merge branch 'main' into fix/improve-shortcuts
Diffstat (limited to 'apps/web/src/app/rss.xml')
-rw-r--r--apps/web/src/app/rss.xml/route.ts42
1 files changed, 21 insertions, 21 deletions
diff --git a/apps/web/src/app/rss.xml/route.ts b/apps/web/src/app/rss.xml/route.ts
index b16bd856..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 } from '../metadata';
+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: 'OpenCut Blog',
+ title: `${SITE_INFO.title} Blog`,
description: SITE_INFO.description,
- id: `${SITE_INFO.url}`,
- link: `${SITE_INFO.url}/blog/`,
- language: 'en',
+ id: `${SITE_URL}`,
+ link: `${SITE_URL}/blog/`,
+ 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_INFO.url}/blog/${post.slug}`,
- link: `${SITE_INFO.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
+}