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: {