diff --git a/src/handlers/feed.ts b/src/handlers/feed.ts new file mode 100644 index 0000000..aaa9295 --- /dev/null +++ b/src/handlers/feed.ts @@ -0,0 +1,12 @@ +import { Hono, Context } from 'hono'; +import { Feed } from 'feed'; + +const feed = new Hono<{ Variables: { feed: Feed }}>(); + +export async function getFeedFile(c: Context) { + c.header('content-type', 'text/xml'); + c.body(""); +} + +feed.get('/rss.xml', getFeedFile); +export default feed; diff --git a/src/models/SiteMeta.ts b/src/models/SiteMeta.ts index 451c9db..00a8d76 100644 --- a/src/models/SiteMeta.ts +++ b/src/models/SiteMeta.ts @@ -1,3 +1,6 @@ +/** + * SiteMeta is often used for the `` tags in the document header + */ export type SiteMeta = { description?: string, tags?: string[], diff --git a/src/services/feed-generator.ts b/src/services/feed-generator.ts index 47d0493..beb90c4 100644 --- a/src/services/feed-generator.ts +++ b/src/services/feed-generator.ts @@ -1,14 +1,10 @@ -// generate the feed -// - import { Feed, FeedOptions } from 'feed'; +import { getSiteConfig } from '@blog/services/config'; export async function feedFactory(): Feed { } export async function generateFeed(posts: PostService, feed: Feed): Feed { - const feed = new Feed({}); - return feed; }