Updated rss feeds
This commit is contained in:
+1
-1
@@ -2,4 +2,4 @@
|
|||||||
// You can import this data from anywhere in your site by using the `import` keyword.
|
// You can import this data from anywhere in your site by using the `import` keyword.
|
||||||
|
|
||||||
export const SITE_TITLE = 'Pantosite';
|
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';
|
||||||
|
|||||||
@@ -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}/`,
|
||||||
|
})),
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -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
@@ -3,14 +3,22 @@ import { getCollection } from 'astro:content';
|
|||||||
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
|
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
|
||||||
|
|
||||||
export async function GET(context) {
|
export async function GET(context) {
|
||||||
const posts = await getCollection('blog');
|
const posts = await getCollection('blog');
|
||||||
return rss({
|
const projects = await getCollection('projects');
|
||||||
title: SITE_TITLE,
|
|
||||||
description: SITE_DESCRIPTION,
|
let unifiedItems = posts.map((post) => ({
|
||||||
site: context.site,
|
...post.data,
|
||||||
items: posts.map((post) => ({
|
link: `/blog/${post.id}/`,
|
||||||
...post.data,
|
})).concat(projects.map((project) => ({
|
||||||
link: `/blog/${post.id}/`,
|
...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,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user