data endpoint for entity 90008 (aka. a website)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: add jsonfeed api

dusk 9ec18b72 c614a66c

+37 -1
+34
src/routes/entries/_jsonfeed/+server.ts
··· 1 + import { PUBLIC_BASE_URL } from '$env/static/public'; 2 + import { _allPosts, type PostData } from '../+layout.ts'; 3 + 4 + const entriesUrl = `${PUBLIC_BASE_URL}/entries`; 5 + 6 + export const GET = async ({ }) => { 7 + return new Response( 8 + render(_allPosts), 9 + { 10 + headers: { 11 + 'content-type': 'application/json', 12 + 'cache-control': 'no-store', 13 + } 14 + }) 15 + }; 16 + 17 + const render = (posts: PostData[]) => { 18 + return JSON.stringify({ 19 + version: 'https://jsonfeed.org/version/1.1', 20 + title: 'gaze.systems posts feed', 21 + home_page_url: PUBLIC_BASE_URL, 22 + feed_url: `${entriesUrl}/_jsonfeed`, 23 + items: posts.map((post) => { 24 + return { 25 + id: post.path, 26 + url: `${entriesUrl}/${post.path}`, 27 + title: post.metadata.title, 28 + summary: post.metadata.excerpt, 29 + content_text: 'read the post on the website', 30 + date_published: new Date(post.metadata.date).toISOString(), 31 + } 32 + }), 33 + }) 34 + }
+3 -1
src/routes/entries/_rss/+server.ts
··· 4 4 const entriesUrl = `${PUBLIC_BASE_URL}/entries`; 5 5 6 6 export const GET = async ({ }) => { 7 - return new Response(render(_allPosts), { 7 + return new Response( 8 + render(_allPosts), 9 + { 8 10 headers: { 9 11 'content-type': 'application/xml', 10 12 'cache-control': 'no-store',