feat: create separated rss feeds
All checks were successful
Docker / build-and-push-image (push) Successful in 2m11s
All checks were successful
Docker / build-and-push-image (push) Successful in 2m11s
This commit is contained in:
parent
4f9ebdcc66
commit
782bfc7c90
10 changed files with 86 additions and 6 deletions
|
@ -1,29 +0,0 @@
|
|||
import rss from "@astrojs/rss";
|
||||
import { SITE } from "@consts";
|
||||
import { getCollection } from "astro:content";
|
||||
|
||||
export async function GET(context: { site: string }) {
|
||||
const posts = (await getCollection("posts")).filter(
|
||||
(post) => !post.data.draft,
|
||||
);
|
||||
|
||||
const projects = (await getCollection("projects")).filter(
|
||||
(project) => !project.data.draft,
|
||||
);
|
||||
|
||||
const items = [...posts, ...projects].sort(
|
||||
(a, b) => new Date(b.data.date).valueOf() - new Date(a.data.date).valueOf(),
|
||||
);
|
||||
|
||||
return rss({
|
||||
title: SITE.TITLE,
|
||||
description: SITE.DESCRIPTION,
|
||||
site: context.site,
|
||||
items: items.map((item) => ({
|
||||
title: item.data.title,
|
||||
description: item.data.description,
|
||||
pubDate: item.data.date,
|
||||
link: `/${item.collection}/${item.slug}/`,
|
||||
})),
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue