From da8c2780f3660550eb139f9abac1e19eadc41089 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Oct 2026 17:14:32 +0000 Subject: [PATCH] fix(docs): honor the next frontmatter override on Next cards src/content.config.ts documents `next` as an override for the next guide link, but [slug].astro always used sequence order, so 25 of the 27 pages that set it showed a different Next card. Use the override when set and fail the build when it names an unknown doc. Co-Authored-By: Claude Opus 5.5 (1M context) Signed-off-by: Claude --- src/pages/docs/[slug].astro | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pages/docs/[slug].astro b/src/pages/docs/[slug].astro index 1a95e60..62b1c71 100644 --- a/src/pages/docs/[slug].astro +++ b/src/pages/docs/[slug].astro @@ -10,12 +10,18 @@ export async function getStaticPaths() { .filter((doc) => doc.id !== "dashboard-tour") .map((doc) => { const index = docs.findIndex((entry) => entry.id === doc.id); + // A `next:` frontmatter slug overrides the sequence order. + const override = doc.data.next; + const nextDoc = override ? docs.find((entry) => entry.id === override) : undefined; + if (override && !nextDoc) { + throw new Error(`docs/${doc.id}: next "${override}" does not match any doc`); + } return { params: { slug: doc.id }, props: { doc, prev: index > 0 ? docs[index - 1] : null, - next: index < docs.length - 1 ? docs[index + 1] : null, + next: nextDoc ?? (index < docs.length - 1 ? docs[index + 1] : null), }, }; });