Update @nuxt/content to version 3.3.0 and refactor content queries

This commit is contained in:
nurRiyad
2025-03-12 03:43:14 +06:00
parent 1aba5e18cc
commit beb5305d65
15 changed files with 2607 additions and 6080 deletions

View File

@@ -1,37 +0,0 @@
import { Feed } from 'feed'
import { serverQueryContent } from '#content/server'
const basePath = 'https://nurriyad.com'
export default defineEventHandler(async (event) => {
setHeader(event, 'content-type', 'text/xml')
const docs = await serverQueryContent(event).sort({ date: -1 }).find()
const feed = new Feed({
title: "Riyad's personal blog site",
description: "Riyad's personal blog site",
id: basePath,
link: basePath,
language: 'en',
favicon: `${basePath}/favicon.ico`,
copyright: 'MIT',
author: {
name: 'Al Asad Nur Riyad',
email: 'asadnurriyad@gmail.com',
link: basePath,
},
})
// Add the feed items
docs.forEach((doc) => {
feed.addItem({
title: doc.title || '',
id: basePath + doc._path,
link: basePath + doc._path,
description: doc.description,
content: doc.description,
date: new Date(doc.date),
})
})
return feed.rss2()
})