tangled
alpha
login
or
join now
hayden.moe
/
www
0
fork
atom
My landing page, written in Astro
hayden.moe
0
fork
atom
overview
issues
pulls
pipelines
fix: drop rss
hayden.moe
4 months ago
240e7c13
f813ab5b
verified
This commit was signed with the committer's
known signature
.
hayden.moe
SSH Key Fingerprint:
SHA256:egi2RxHATuWGOtHoLWJQb68bxJ+Jg/4m40QL5UFBWEI=
-32
1 changed file
expand all
collapse all
unified
split
src
pages
rss.xml.ts
-32
src/pages/rss.xml.ts
···
1
1
-
import rss from '@astrojs/rss';
2
2
-
import type { APIContext } from "astro";
3
3
-
import { getPosts } from '~/atproto/getPosts';
4
4
-
5
5
-
export const prerender = false;
6
6
-
7
7
-
export const GET = async (context: APIContext) => {
8
8
-
const posts = await getPosts(context.locals, undefined);
9
9
-
10
10
-
const postsFiltered = posts.filter(p => !p.content?.startsWith('NOT_LIVE'));
11
11
-
12
12
-
const postsShortened = postsFiltered.map(p => {
13
13
-
if (p.content?.length! > 200) {
14
14
-
p.content = p.content?.slice(0, 200).trimEnd() + '...';
15
15
-
}
16
16
-
return p;
17
17
-
});
18
18
-
19
19
-
return rss({
20
20
-
title: 'Hayden\'s Blog',
21
21
-
description: 'The blog of a lowly DevOps Engineer from the UK. Federated on atproto!',
22
22
-
site: context.site,
23
23
-
24
24
-
items: postsShortened.map(post => ({
25
25
-
id: `${context.site}posts/${post.rkey}/`,
26
26
-
title: post.title,
27
27
-
link: `${context.site}posts/${post.rkey}/`,
28
28
-
date: new Date(post.createdAt),
29
29
-
description: post.content,
30
30
-
})),
31
31
-
});
32
32
-
};