Fixed rss images

This commit is contained in:
Anton Pogrebnjak
2026-05-29 19:58:26 +02:00
parent da0d7f239c
commit 7a46c28060
3 changed files with 33 additions and 9 deletions
+14 -2
View File
@@ -9,9 +9,21 @@ export async function GET(context) {
title: SITE_TITLE, title: SITE_TITLE,
description: SITE_DESCRIPTION, description: SITE_DESCRIPTION,
site: context.site, site: context.site,
items: posts.map((post) => ({ items: posts.map((post) => {
let item = {
...post.data, ...post.data,
link: `/blog/${post.id}/`, link: `/blog/${post.id}/`,
})), };
if (post.data.heroImage) {
item.enclosure = {
url: post.data.heroImage.src,
length: post.data.heroImage.width * post.data.heroImage.height,
type: `image/${post.data.heroImage.format}`
}
}
return item;
})
}); });
} }
+16 -4
View File
@@ -9,9 +9,21 @@ export async function GET(context) {
title: SITE_TITLE, title: SITE_TITLE,
description: SITE_DESCRIPTION, description: SITE_DESCRIPTION,
site: context.site, site: context.site,
items: posts.map((post) => ({ items: posts.map((project) => {
...post.data, let item = {
link: `/projects/${post.id}/`, ...project.data,
})), link: `/projects/${project.id}/`,
};
if (project.data.heroImage) {
item.enclosure = {
url: project.data.heroImage.src,
length: project.data.heroImage.width * project.data.heroImage.height,
type: `image/${project.data.heroImage.format}`
}
}
return item;
}),
}); });
} }
+1 -1
View File
@@ -27,7 +27,7 @@ export async function GET(context) {
link: `/projects/${project.id}/`, link: `/projects/${project.id}/`,
}; };
if (project.heroImage) { if (project.data.heroImage) {
item.enclosure = { item.enclosure = {
url: project.data.heroImage.src, url: project.data.heroImage.src,
length: project.data.heroImage.width * project.data.heroImage.height, length: project.data.heroImage.width * project.data.heroImage.height,