add new blogs

This commit is contained in:
Zoe
2023-01-01 05:01:45 -06:00
parent 3f412b8a34
commit 471496018a
19 changed files with 392 additions and 63 deletions

22
server/routes/.rss.ts Normal file
View File

@@ -0,0 +1,22 @@
import { serverQueryContent } from '#content/server'
import RSS from 'rss'
export default defineEventHandler(async (event) => {
// Fetch all documents
const docs = await serverQueryContent(event).find()
const feed = new RSS({
title: 'Juls07',
description: 'Juls07\'s blogs',
link: 'https://juls07.dev/blogs'
})
for (const doc of docs) {
feed.item({
title: doc.title,
description: doc.description,
image_url: doc.image.src
})
}
return feed.xml({ indent: true })
})

View File

@@ -10,7 +10,8 @@ export default defineEventHandler(async (event) => {
for (const doc of docs) {
sitemap.write({
url: doc._path
url: doc._path,
changefreq: 'monthly'
})
}
sitemap.end()