feat: remove jsonfeed, fix rss links
This commit is contained in:
parent
ee926f5d6d
commit
51e4bd1a6c
@ -166,9 +166,10 @@
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
{#if isRoute("entries")}
|
{#if isRoute("entries")}
|
||||||
<div class="navbox !gap-1">
|
<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>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
@ -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(),
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user