feat: add rss

This commit is contained in:
KazooTTT
2024-11-23 16:51:13 +08:00
parent 01c70257a1
commit 790c91c342
7 changed files with 22 additions and 6 deletions

View File

@ -45,7 +45,7 @@ const mdProjects = allPosts
.map((post) => ({
title: post.data.title,
description: post.data.description || '',
url: post.data.projectUrl ? post.data.projectUrl : `/posts/${post.slug}`,
url: post.data.projectUrl ? post.data.projectUrl : `/blog/${post.slug}`,
imagePath: post.data.coverImage,
altText: post.data.title,
isExternal: !!post.data.projectUrl

View File

@ -1,17 +1,17 @@
import rss from '@astrojs/rss'
import { siteConfig } from '@/site-config'
import { getAllPosts } from '@/utils'
import { getAllSortedPosts } from '@/utils'
export const GET = async () => {
const posts = await getAllPosts()
const posts = await getAllSortedPosts()
return rss({
title: siteConfig.title,
description: siteConfig.description,
site: import.meta.env.SITE,
items: posts.map((post) => ({
title: post.data.title,
description: post.data.description,
title: post.data.title ?? '',
description: `${post.data.description ?? ''}\nfeedId:76245438397618182+userId:62156866798228480`,
pubDate: post.data.date,
link: `/blog/${post.slug}`
}))