From 32fa01e45824a15d563682e222b37a672c5ad973 Mon Sep 17 00:00:00 2001 From: hiro Date: Sat, 2 Nov 2024 02:14:52 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20tag=E3=81=AE=E6=8A=95=E7=A8=BF?= =?UTF-8?q?=E3=83=AA=E3=82=B9=E3=83=88=E7=94=9F=E6=88=90=E3=82=92map?= =?UTF-8?q?=E9=96=A2=E6=95=B0=E3=82=92=E4=BD=BF=E7=94=A8=E3=81=97=E3=81=A6?= =?UTF-8?q?=E7=B0=A1=E7=B4=A0=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/tags/[slug]/_libs/getStaticPropsTagDetail.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/pages/tags/[slug]/_libs/getStaticPropsTagDetail.ts b/src/pages/tags/[slug]/_libs/getStaticPropsTagDetail.ts index 8c4058226..2946ba9f5 100644 --- a/src/pages/tags/[slug]/_libs/getStaticPropsTagDetail.ts +++ b/src/pages/tags/[slug]/_libs/getStaticPropsTagDetail.ts @@ -14,17 +14,15 @@ const allTags = getTagsJson(); export const getStaticPropsTagDetail: GetStaticProps = (context: GetStaticPropsContext) => { const slug = context.params?.slug as string; const tag = allTags[slug]; - const tagsPosts: TermsPostListProps[] = []; - - for (const postSlug of tag) { + const tagsPosts: TermsPostListProps[] = tag.map((postSlug: string) => { const { title, date, updated } = allPosts.get(postSlug); - tagsPosts.push({ + return { title, slug: postSlug, date, ...(updated && { updated }), - }); - } + }; + }); return { props: {