From dd69c9cf08f3b6b88fbf73fb4aff581a9f0c348b Mon Sep 17 00:00:00 2001 From: MattIPv4 Date: Tue, 21 Oct 2025 02:16:04 +0100 Subject: [PATCH 1/2] Fallback to Maintenance LTS if no Active LTS found --- apps/site/components/withDownloadSection.tsx | 2 +- apps/site/components/withFooter.tsx | 2 +- apps/site/components/withNodeRelease.tsx | 16 +++++++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/apps/site/components/withDownloadSection.tsx b/apps/site/components/withDownloadSection.tsx index 3caa60d024598..4eb929eb0d5b8 100644 --- a/apps/site/components/withDownloadSection.tsx +++ b/apps/site/components/withDownloadSection.tsx @@ -38,7 +38,7 @@ const WithDownloadSection: FC = ({ // Decides which initial release to use based on the current pathname const initialRelease = pathname.endsWith('/current') ? 'Current' - : 'Active LTS'; + : ['Active LTS' as const, 'Maintenance LTS' as const]; return ( diff --git a/apps/site/components/withFooter.tsx b/apps/site/components/withFooter.tsx index b334621adff20..72cbc8b13d9ee 100644 --- a/apps/site/components/withFooter.tsx +++ b/apps/site/components/withFooter.tsx @@ -22,7 +22,7 @@ const WithFooter: FC = () => { const primary = (
- + {({ release }) => ( = async ({ }) => { const releaseData = await provideReleaseData(); - const matchingRelease = releaseData.find(release => - [status].flat().includes(release.status) - ); + let matchingRelease: NodeRelease | undefined; + for (const statusItem of Array.isArray(status) ? status : [status]) { + matchingRelease = releaseData.find( + release => release.status === statusItem + ); + if (matchingRelease) { + break; + } + } - if (matchingRelease !== undefined) { - return ; + if (matchingRelease) { + return ; } return null; From 14787159e9e257402e92712f235b8d0241dde166 Mon Sep 17 00:00:00 2001 From: MattIPv4 Date: Tue, 21 Oct 2025 02:27:44 +0100 Subject: [PATCH 2/2] Apply similar Maintenance LTS fallback to Orama logic --- apps/site/scripts/orama-search/get-documents.mjs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/site/scripts/orama-search/get-documents.mjs b/apps/site/scripts/orama-search/get-documents.mjs index 01580f3833ecd..b6d4ffdf73fc2 100644 --- a/apps/site/scripts/orama-search/get-documents.mjs +++ b/apps/site/scripts/orama-search/get-documents.mjs @@ -18,13 +18,17 @@ const fetchOptions = process.env.GITHUB_TOKEN export const getAPIDocs = async () => { // Find the current Active LTS version const releaseData = await generateReleaseData(); - const { versionWithPrefix } = releaseData.find( - r => r.status === 'Active LTS' - ); + const ltsRelease = + releaseData.find(r => r.status === 'Active LTS') || + releaseData.find(r => r.status === 'Maintenance LTS'); + + if (!ltsRelease) { + throw new Error('No Active LTS or Maintenance LTS release found'); + } // Get list of API docs from the Node.js repo const fetchResponse = await fetch( - `https://api.github.com/repos/nodejs/node/contents/doc/api?ref=${versionWithPrefix}`, + `https://api.github.com/repos/nodejs/node/contents/doc/api?ref=${ltsRelease.versionWithPrefix}`, fetchOptions ); const documents = await fetchResponse.json(); @@ -36,7 +40,7 @@ export const getAPIDocs = async () => { return { content: await res.text(), - pathname: `docs/${versionWithPrefix}/api/${basename(name, '.md')}.html`, + pathname: `docs/${ltsRelease.versionWithPrefix}/api/${basename(name, '.md')}.html`, }; }) );