format all code (#386)
This commit is contained in:
1 parent
7ea2f7f40f
commit
286b050fa8
61 files changed
+1329
-1307
No files matched your search
+27
-27
@@ -1,33 +1,33 @@
|
||||
import { siteConfig } from '@/config'
|
||||
import rss from '@astrojs/rss'
|
||||
import { getSortedPosts } from '@utils/content-utils'
|
||||
import type { APIContext } from 'astro'
|
||||
import MarkdownIt from 'markdown-it'
|
||||
import sanitizeHtml from 'sanitize-html'
|
||||
import { siteConfig } from "@/config";
|
||||
import rss from "@astrojs/rss";
|
||||
import { getSortedPosts } from "@utils/content-utils";
|
||||
import type { APIContext } from "astro";
|
||||
import MarkdownIt from "markdown-it";
|
||||
import sanitizeHtml from "sanitize-html";
|
||||
|
||||
const parser = new MarkdownIt()
|
||||
const parser = new MarkdownIt();
|
||||
|
||||
export async function GET(context: APIContext) {
|
||||
const blog = await getSortedPosts()
|
||||
const blog = await getSortedPosts();
|
||||
|
||||
return rss({
|
||||
title: siteConfig.title,
|
||||
description: siteConfig.subtitle || 'No description',
|
||||
site: context.site ?? 'https://fuwari.vercel.app',
|
||||
items: blog.map(post => {
|
||||
const content =
|
||||
typeof post.body === 'string' ? post.body : String(post.body || '')
|
||||
return rss({
|
||||
title: siteConfig.title,
|
||||
description: siteConfig.subtitle || "No description",
|
||||
site: context.site ?? "https://fuwari.vercel.app",
|
||||
items: blog.map((post) => {
|
||||
const content =
|
||||
typeof post.body === "string" ? post.body : String(post.body || "");
|
||||
|
||||
return {
|
||||
title: post.data.title,
|
||||
pubDate: post.data.published,
|
||||
description: post.data.description || '',
|
||||
link: `/posts/${post.slug}/`,
|
||||
content: sanitizeHtml(parser.render(content), {
|
||||
allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img']),
|
||||
}),
|
||||
}
|
||||
}),
|
||||
customData: `<language>${siteConfig.lang}</language>`,
|
||||
})
|
||||
return {
|
||||
title: post.data.title,
|
||||
pubDate: post.data.published,
|
||||
description: post.data.description || "",
|
||||
link: `/posts/${post.slug}/`,
|
||||
content: sanitizeHtml(parser.render(content), {
|
||||
allowedTags: sanitizeHtml.defaults.allowedTags.concat(["img"]),
|
||||
}),
|
||||
};
|
||||
}),
|
||||
customData: `<language>${siteConfig.lang}</language>`,
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user