fix: sort post list in RSS by time and exclude draft posts

This commit is contained in:
saicaca 2024-07-20 23:47:40 +08:00
parent bd4f0e8b63
commit 2622aabe07
1 changed files with 2 additions and 1 deletions

View File

@ -3,10 +3,11 @@ import {siteConfig} from '@/config';
import { getCollection } from 'astro:content';
import sanitizeHtml from 'sanitize-html';
import MarkdownIt from 'markdown-it';
import {getSortedPosts} from "@utils/content-utils.ts";
const parser = new MarkdownIt();
export async function GET(context: any) {
const blog = await getCollection('posts');
const blog = await getSortedPosts();
return rss({
title: siteConfig.title,
description: siteConfig.subtitle || 'No description',