diff --git a/src/pages/[...slug].astro b/src/pages/[...slug].astro index 4bc18f1..7b00093 100644 --- a/src/pages/[...slug].astro +++ b/src/pages/[...slug].astro @@ -6,8 +6,7 @@ import { getBlogDescription } from '../lib/get-blog-description'; import { renderDateToHtml } from '../lib/render-date-to-html'; export async function getStaticPaths() { - const entries = await getCollection('blog'); - return entries.map((entry) => ({ + return (await getCollection('blog')).map((entry) => ({ params: { slug: entry.slug }, props: { entry }, })); diff --git a/src/pages/blog.astro b/src/pages/blog.astro index 729ceaf..ce0e278 100644 --- a/src/pages/blog.astro +++ b/src/pages/blog.astro @@ -12,15 +12,12 @@ const title = 'ブログ'; const items = await Promise.all( (await getCollection('blog')) .toSorted((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()) - .map(async (entry) => { - const description = await getBlogDescription(entry); - return { - title: entry.data.title, - link: getBlogUrl(entry), - meta: renderDateToHtml(entry.data.pubDate), - description, - }; - }), + .map(async (entry) => ({ + title: entry.data.title, + link: getBlogUrl(entry), + meta: renderDateToHtml(entry.data.pubDate), + description: await getBlogDescription(entry), + })), ); --- diff --git a/src/pages/external-posts.astro b/src/pages/external-posts.astro index 9bc3f09..ad7fd64 100644 --- a/src/pages/external-posts.astro +++ b/src/pages/external-posts.astro @@ -8,16 +8,14 @@ import { renderDateToHtml } from '../lib/render-date-to-html'; const title = '外部サイトの投稿'; const description = '外部サイトに寄稿した記事、登壇したイベントやスライド、出版物など。'; -const items = await Promise.all( - (await getCollection('external-post')) - .toSorted((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()) - .map(async (entry) => ({ - title: entry.data.title, - link: entry.data.link, - meta: `${renderDateToHtml(entry.data.pubDate)} · ${entry.data.channel}`, - description: entry.data.description, - })), -); +const items = (await getCollection('external-post')) + .toSorted((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()) + .map((entry) => ({ + title: entry.data.title, + link: entry.data.link, + meta: `${renderDateToHtml(entry.data.pubDate)} · ${entry.data.channel}`, + description: entry.data.description, + })); --- diff --git a/src/pages/rss.xml.ts b/src/pages/rss.xml.ts index 9cb1045..1d901b6 100644 --- a/src/pages/rss.xml.ts +++ b/src/pages/rss.xml.ts @@ -13,8 +13,9 @@ import { getBlogUrl } from '../lib/get-blog-url'; export async function GET(context: APIContext) { invariant(context.site); - const renderers = await loadRenderers([getContainerRenderer()]); - const container = await AstroContainer.create({ renderers }); + const container = await AstroContainer.create({ + renderers: await loadRenderers([getContainerRenderer()]), + }); const items = await Promise.all( [...(await getCollection('blog')), ...(await getCollection('external-post'))]