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.
|
||||
|
||||
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';
|
||||
|
||||
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,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user