Add the route handler for the XML feed.
This commit is contained in:
parent
ab5a83202e
commit
21fb068901
12
src/handlers/feed.ts
Normal file
12
src/handlers/feed.ts
Normal file
@ -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;
|
@ -1,3 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* SiteMeta is often used for the `<meta />` tags in the document header
|
||||||
|
*/
|
||||||
export type SiteMeta = {
|
export type SiteMeta = {
|
||||||
description?: string,
|
description?: string,
|
||||||
tags?: string[],
|
tags?: string[],
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
// generate the feed
|
|
||||||
//
|
|
||||||
|
|
||||||
import { Feed, FeedOptions } from 'feed';
|
import { Feed, FeedOptions } from 'feed';
|
||||||
|
import { getSiteConfig } from '@blog/services/config';
|
||||||
|
|
||||||
export async function feedFactory(): Feed {
|
export async function feedFactory(): Feed {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function generateFeed(posts: PostService, feed: Feed): Feed {
|
export async function generateFeed(posts: PostService, feed: Feed): Feed {
|
||||||
const feed = new Feed({});
|
|
||||||
|
|
||||||
return feed;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user