1- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2- // @ts -nocheck
3- // TODO(@AVIVKELLER): THIS FILE
41import { defaultLocale } from '@node-core/website-i18n' ;
52import { notFound , redirect } from 'next/navigation' ;
63
74import provideReleaseData from '#site/next-data/providers/releaseData' ;
85import provideReleaseVersions from '#site/next-data/providers/releaseVersions' ;
96import { ENABLE_STATIC_EXPORT } from '#site/next.constants.mjs' ;
7+ import { getMarkdownFile } from '#site/router' ;
8+ import { renderPage } from '#site/router/render' ;
109
1110import type { DynamicParams } from '#site/types' ;
1211import type { FC } from 'react' ;
@@ -37,10 +36,7 @@ export const generateStaticParams = async () => {
3736// finally it returns (if the locale and route are valid) the React Component with the relevant context
3837// and attached context providers for rendering the current page
3938const getPage : FC < PageParams > = async props => {
40- const { version, locale : routeLocale } = await props . params ;
41-
42- // Gets the current full pathname for a given path
43- const [ locale , pathname ] = basePage . getLocaleAndPath ( version , routeLocale ) ;
39+ const { version, locale } = await props . params ;
4440
4541 if ( version === 'current' ) {
4642 const releaseData = await provideReleaseData ( ) ;
@@ -53,22 +49,15 @@ const getPage: FC<PageParams> = async props => {
5349 const versions = await provideReleaseVersions ( ) ;
5450
5551 // Verifies if the current route is a dynamic route
56- const isDynamicRoute = versions . some ( r => r . includes ( pathname ) ) ;
57-
58- // Gets the Markdown content and context for Download Archive pages
59- const [ content , context ] = await basePage . getMarkdownContext ( {
60- locale,
61- pathname : 'download/archive' ,
62- } ) ;
52+ const isDynamicRoute = versions . some ( r => r . includes ( version ) ) ;
6353
6454 // If this isn't a valid dynamic route for archive version or there's no markdown
6555 // file for this, then we fail as not found as there's nothing we can do.
66- if ( isDynamicRoute && context . filename ) {
67- return basePage . renderPage ( {
68- content,
69- layout : context . frontmatter . layout ! ,
70- context : { ...context , pathname : `/download/archive/${ pathname } ` } ,
71- } ) ;
56+ if ( isDynamicRoute ) {
57+ const markdown = ( await getMarkdownFile ( locale , 'download/archive' ) ) ! ;
58+ markdown . pathname = `/download/archive/${ version } ` ;
59+
60+ return renderPage ( markdown ) ;
7261 }
7362
7463 return notFound ( ) ;
0 commit comments