the only good website on the internet quaso.engineering
at main 1.1 kB view raw
1import { Feed } from 'feed'; 2import { getPosts } from '$lib/posts'; 3 4export const makeFeed = () => { 5 const feed = new Feed({ 6 title: 'justin.duch.me', 7 description: 'a very good blog', 8 id: 'https://justin.duch.me/', 9 link: 'https://justin.duch.me/', 10 favicon: 'https://justin.duch.me/favicon.ico', 11 author: { 12 name: 'Justin Duch', 13 email: 'justin@duch.me' 14 }, 15 feedLinks: { 16 rss: 'https://justin.duch.me/rss', 17 atom: 'https://justin.duch.me/atom' 18 }, 19 language: 'en', 20 copyright: 'All rights reserved' 21 }); 22 23 getPosts() 24 .sort((a, b) => new Date(b.date).valueOf() - new Date(a.date).valueOf()) 25 .forEach((p) => { 26 feed.addItem({ 27 title: p.title, 28 content: p.html, 29 id: `https://justin.duch.me/post/${p.slug}`, 30 link: `https://justin.duch.me/post/${p.slug}`, 31 date: new Date(p.date), 32 author: [ 33 { 34 name: 'Justin Duch', 35 email: 'justin@duch.me', 36 link: 'https://justin.duch.me' 37 } 38 ] 39 }); 40 }); 41 42 return feed; 43};