Updated rss feeds

This commit is contained in:
Anton Pogrebnjak
2026-05-03 00:53:30 +02:00
parent cd252fc6ae
commit 59e1df4436
4 changed files with 53 additions and 11 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
// You can import this data from anywhere in your site by using the `import` keyword.
export const SITE_TITLE = 'Pantosite';
export const SITE_DESCRIPTION = 'The personal Blog of one Anton Pogrebnjak';
export const SITE_DESCRIPTION = 'The personal website of Anton';
+17
View File
@@ -0,0 +1,17 @@
import rss from '@astrojs/rss';
import { getCollection } from 'astro:content';
import { SITE_TITLE, SITE_DESCRIPTION } from '../../consts';
export async function GET(context) {
const posts = await getCollection('blog');
return rss({
title: SITE_TITLE,
description: SITE_DESCRIPTION,
site: context.site,
items: posts.map((post) => ({
...post.data,
link: `/blog/${post.id}/`,
})),
});
}
+17
View File
@@ -0,0 +1,17 @@
import rss from '@astrojs/rss';
import { getCollection } from 'astro:content';
import { SITE_TITLE, SITE_DESCRIPTION } from '../../consts';
export async function GET(context) {
const posts = await getCollection('projects');
return rss({
title: SITE_TITLE,
description: SITE_DESCRIPTION,
site: context.site,
items: posts.map((post) => ({
...post.data,
link: `/projects/${post.id}/`,
})),
});
}
+18 -10
View File
@@ -3,14 +3,22 @@ import { getCollection } from 'astro:content';
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
export async function GET(context) {
const posts = await getCollection('blog');
return rss({
title: SITE_TITLE,
description: SITE_DESCRIPTION,
site: context.site,
items: posts.map((post) => ({
...post.data,
link: `/blog/${post.id}/`,
})),
});
const posts = await getCollection('blog');
const projects = await getCollection('projects');
let unifiedItems = posts.map((post) => ({
...post.data,
link: `/blog/${post.id}/`,
})).concat(projects.map((project) => ({
...project.data,
link: `/projects/${project.id}/`
})));
unifiedItems = unifiedItems.sort((a, b) => b.pubDate - a.pubDate);
return rss({
title: SITE_TITLE,
description: SITE_DESCRIPTION,
site: context.site,
items: unifiedItems,
});
}