feat: remove jsonfeed, fix rss links

This commit is contained in:
dusk 2024-12-16 15:09:20 +03:00
parent ee926f5d6d
commit 51e4bd1a6c
Signed by: dusk
SSH Key Fingerprint: SHA256:Abmvag+juovVufZTxyWY8KcVgrznxvBjQpJesv071Aw
2 changed files with 3 additions and 36 deletions

View File

@ -166,9 +166,10 @@
</Tooltip>
{#if isRoute("entries")}
<div class="navbox !gap-1">
<a class="align-middle hover:underline" href="/entries/_rss">rss</a>
rss:
<a class="align-middle hover:underline" href="/entries/_rss">posts</a>
/
<a class="align-middle hover:underline" href="/entries/_jsonfeed">jsonfeed</a>
<a class="align-middle hover:underline" href="/log/_rss">log</a>
</div>
{/if}
</div>

View File

@ -1,34 +0,0 @@
import { PUBLIC_BASE_URL } from '$env/static/public';
import { _allPosts, type PostData } from '../+layout.ts';
const entriesUrl = `${PUBLIC_BASE_URL}/entries`;
export const GET = async ({ }) => {
return new Response(
render(_allPosts),
{
headers: {
'content-type': 'application/json',
'cache-control': 'no-store',
}
})
};
const render = (posts: PostData[]) => {
return JSON.stringify({
version: 'https://jsonfeed.org/version/1.1',
title: 'gaze.systems posts feed',
home_page_url: PUBLIC_BASE_URL,
feed_url: `${entriesUrl}/_jsonfeed`,
items: posts.map((post) => {
return {
id: post.path,
url: `${entriesUrl}/${post.path}`,
title: post.metadata.title,
summary: post.metadata.excerpt,
content_text: 'read the post on the website',
date_published: new Date(post.metadata.date).toISOString(),
}
}),
})
}