Skip to content

Commit 4d824c4

Browse files
committed
fixup!
1 parent 2492151 commit 4d824c4

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

apps/site/app/[locale]/download/archive/[version]/page.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { notFound, redirect } from 'next/navigation';
22
import type { FC } from 'react';
33

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

32-
return ARCHIVE_DYNAMIC_ROUTES.map(version => ({
32+
const versions = await provideReleaseVersions();
33+
34+
return versions.map(version => ({
3335
locale: defaultLocale.code,
3436
version,
3537
}));
@@ -53,8 +55,10 @@ const getPage: FC<PageParams> = async props => {
5355
redirect(`/${locale}/download/archive/${release?.versionWithPrefix}`);
5456
}
5557

58+
const versions = await provideReleaseVersions();
59+
5660
// Verifies if the current route is a dynamic route
57-
const isDynamicRoute = ARCHIVE_DYNAMIC_ROUTES.some(r => r.includes(pathname));
61+
const isDynamicRoute = versions.some(r => r.includes(pathname));
5862

5963
// Gets the Markdown content and context for Download Archive pages
6064
const [content, context] = await basePage.getMarkdownContext({

apps/site/next.dynamic.constants.mjs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

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

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

31-
/**
32-
* This constant is used to create static routes on-the-fly that do not have a file-system
33-
* counterpart route. This is useful for providing routes with matching Layout Names
34-
* but that do not have Markdown content and a matching file for the route
35-
*
36-
* @type {Array<string>} A Map of pathname and Layout Name
37-
*/
38-
export const ARCHIVE_DYNAMIC_ROUTES = [
39-
// Creates dynamic routes for downloads archive pages for each version
40-
// (e.g., /download/archive/v18.20.8, /download/archive/v20.19.2)
41-
...(await provideReleaseVersions()),
42-
];
43-
4430
/**
4531
* This is the default Next.js Page Metadata for all pages
4632
*

0 commit comments

Comments
 (0)