Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup!
  • Loading branch information
avivkeller committed Oct 18, 2025
commit 4d824c415c565168d8086108747380f836cac36f
10 changes: 7 additions & 3 deletions apps/site/app/[locale]/download/archive/[version]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { notFound, redirect } from 'next/navigation';
import type { FC } from 'react';

import provideReleaseData from '#site/next-data/providers/releaseData';
import provideReleaseVersions from '#site/next-data/providers/releaseVersions';
import { ENABLE_STATIC_EXPORT } from '#site/next.constants.mjs';
import { ARCHIVE_DYNAMIC_ROUTES } from '#site/next.dynamic.constants.mjs';
import * as basePage from '#site/next.dynamic.page.mjs';
import { defaultLocale } from '#site/next.locales.mjs';
import type { DynamicParams } from '#site/types';
Expand All @@ -29,7 +29,9 @@ export const generateStaticParams = async () => {
return [];
}

return ARCHIVE_DYNAMIC_ROUTES.map(version => ({
const versions = await provideReleaseVersions();

return versions.map(version => ({
locale: defaultLocale.code,
version,
}));
Expand All @@ -53,8 +55,10 @@ const getPage: FC<PageParams> = async props => {
redirect(`/${locale}/download/archive/${release?.versionWithPrefix}`);
}

const versions = await provideReleaseVersions();

// Verifies if the current route is a dynamic route
const isDynamicRoute = ARCHIVE_DYNAMIC_ROUTES.some(r => r.includes(pathname));
const isDynamicRoute = versions.some(r => r.includes(pathname));

// Gets the Markdown content and context for Download Archive pages
const [content, context] = await basePage.getMarkdownContext({
Expand Down
14 changes: 0 additions & 14 deletions apps/site/next.dynamic.constants.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

import { provideBlogPosts } from '#site/next-data/providers/blogData';
import provideReleaseVersions from '#site/next-data/providers/releaseVersions';
import { blogData } from '#site/next.json.mjs';

import { BASE_PATH, BASE_URL } from './next.constants.mjs';
Expand All @@ -28,19 +27,6 @@ export const BLOG_DYNAMIC_ROUTES = [
.flat(),
];

/**
* This constant is used to create static routes on-the-fly that do not have a file-system
* counterpart route. This is useful for providing routes with matching Layout Names
* but that do not have Markdown content and a matching file for the route
*
* @type {Array<string>} A Map of pathname and Layout Name
*/
export const ARCHIVE_DYNAMIC_ROUTES = [
// Creates dynamic routes for downloads archive pages for each version
// (e.g., /download/archive/v18.20.8, /download/archive/v20.19.2)
...(await provideReleaseVersions()),
];

/**
* This is the default Next.js Page Metadata for all pages
*
Expand Down
Loading