Add images to rss feed

Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2026-03-20 21:06:59 +01:00
parent 19e9671dfc
commit eca0b50fff

View File

@@ -11,6 +11,11 @@ export async function GET(context: APIContext) {
pubDate: post.data.publishDate, pubDate: post.data.publishDate,
description: post.data.description, description: post.data.description,
link: `/blog/${post.id}/`, link: `/blog/${post.id}/`,
enclosure: {
url: new URL(post.data.image.src, context.site).toString(),
length: 0,
type: "image/png",
},
})); }));
const projectItems = projects.map((project) => ({ const projectItems = projects.map((project) => ({
@@ -18,6 +23,11 @@ export async function GET(context: APIContext) {
pubDate: new Date(), pubDate: new Date(),
description: project.data.description, description: project.data.description,
link: `/projects/${project.id}/`, link: `/projects/${project.id}/`,
enclosure: {
url: new URL(project.data.image.src, context.site).toString(),
length: 0,
type: "image/png",
},
})); }));
const allItems = [...blogItems, ...projectItems].sort( const allItems = [...blogItems, ...projectItems].sort(
@@ -27,7 +37,7 @@ export async function GET(context: APIContext) {
return rss({ return rss({
title: "Another Hadi", title: "Another Hadi",
description: description:
"Thoughts, insights, and tutorials on cybersecurity, OSINT, and technology.", "Thoughts, insights, and tutorials on cybersecurity, OSINT, and technology.",
site: context.site!, site: context.site!,
items: allItems, items: allItems,
customData: `<language>en</language>`, customData: `<language>en</language>`,