From 37ef86348afceae6dbaa60a4484a918f2fdda4ad Mon Sep 17 00:00:00 2001 From: kiwiyou Date: Fri, 1 Nov 2024 16:22:20 +0900 Subject: [PATCH] fix: editorial contest id (#26) --- src/pages/editorial/[...slug].astro | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/pages/editorial/[...slug].astro b/src/pages/editorial/[...slug].astro index 5601440..2205fb7 100644 --- a/src/pages/editorial/[...slug].astro +++ b/src/pages/editorial/[...slug].astro @@ -20,15 +20,13 @@ export const getStaticPaths = (async () => { })) }) satisfies GetStaticPaths -const { slug } = Astro.params const { entry } = Astro.props -const [year, month, tag, index] = slug.split("/") -const id = `${year}-${month}-${tag}` const collection = await getContests() const { data: contest } = collection.find( - ({ id: contestId }) => contestId === id, + ({ id }) => id === entry.data.contest, )! -const { number, title } = contest.problems[+index] +const index = +entry.data.index +const { number, title } = contest.problems[index] const path = [ { name: "홈", @@ -41,7 +39,7 @@ const path = [ }, ] satisfies Path -const author = contest.authors?.[+index] +const author = contest.authors?.[index] const { Content } = await render(entry) ---