fix: sort post list in RSS by time and exclude draft posts
This commit is contained in:
parent
bd4f0e8b63
commit
2622aabe07
|
@ -3,10 +3,11 @@ import {siteConfig} from '@/config';
|
||||||
import { getCollection } from 'astro:content';
|
import { getCollection } from 'astro:content';
|
||||||
import sanitizeHtml from 'sanitize-html';
|
import sanitizeHtml from 'sanitize-html';
|
||||||
import MarkdownIt from 'markdown-it';
|
import MarkdownIt from 'markdown-it';
|
||||||
|
import {getSortedPosts} from "@utils/content-utils.ts";
|
||||||
const parser = new MarkdownIt();
|
const parser = new MarkdownIt();
|
||||||
|
|
||||||
export async function GET(context: any) {
|
export async function GET(context: any) {
|
||||||
const blog = await getCollection('posts');
|
const blog = await getSortedPosts();
|
||||||
return rss({
|
return rss({
|
||||||
title: siteConfig.title,
|
title: siteConfig.title,
|
||||||
description: siteConfig.subtitle || 'No description',
|
description: siteConfig.subtitle || 'No description',
|
||||||
|
|
Loading…
Reference in New Issue