mirror of
https://github.com/KazooTTT/kazoottt-blog-v2.git
synced 2025-06-23 02:31:31 +08:00
feat: rss add category
This commit is contained in:
@ -17,7 +17,6 @@ const post = defineCollection({
|
|||||||
draft: z.boolean().default(false),
|
draft: z.boolean().default(false),
|
||||||
banner: z.string().optional(),
|
banner: z.string().optional(),
|
||||||
tags: z.array(z.string()).default([]).transform(removeDupsAndLowerCase),
|
tags: z.array(z.string()).default([]).transform(removeDupsAndLowerCase),
|
||||||
categories: z.array(z.string()).default([]).transform(removeDupsAndLowerCase),
|
|
||||||
date: z.union([z.string(), z.date()]).transform((val) => new Date(val)),
|
date: z.union([z.string(), z.date()]).transform((val) => new Date(val)),
|
||||||
date_modified: z.date().optional(),
|
date_modified: z.date().optional(),
|
||||||
data_created: z.date().optional(),
|
data_created: z.date().optional(),
|
||||||
|
@ -18,20 +18,24 @@ export const GET = async () => {
|
|||||||
title: siteConfig.title,
|
title: siteConfig.title,
|
||||||
description: siteConfig.description,
|
description: siteConfig.description,
|
||||||
site: import.meta.env.SITE,
|
site: import.meta.env.SITE,
|
||||||
items: sortedPosts.map((post) => ({
|
items: sortedPosts.map((post) => {
|
||||||
title: post.data.title,
|
console.log(post.data);
|
||||||
description: post.data.description ?? "",
|
return {
|
||||||
pubDate: post.data.date,
|
title: post.data.title,
|
||||||
link: `posts/${post.id}/`,
|
description: post.data.description ?? "",
|
||||||
content: post.body
|
pubDate: post.data.date,
|
||||||
? sanitizeHtml(parser.render(post.body), {
|
link: `posts/${post.id}/`,
|
||||||
allowedTags: sanitizeHtml.defaults.allowedTags.concat(["img"]),
|
content: post.body
|
||||||
textFilter: function (text: string) {
|
? sanitizeHtml(parser.render(post.body), {
|
||||||
return text.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F\uFFF0-\uFFFF]/g, "");
|
allowedTags: sanitizeHtml.defaults.allowedTags.concat(["img"]),
|
||||||
},
|
textFilter: function (text: string) {
|
||||||
})
|
return text.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F\uFFF0-\uFFFF]/g, "");
|
||||||
: "",
|
},
|
||||||
author: siteConfig.author,
|
})
|
||||||
})),
|
: "",
|
||||||
|
author: siteConfig.author,
|
||||||
|
category: post.data?.category,
|
||||||
|
};
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user