Skip to content

Commit 8325ac9

Browse files
committed
Fixed Archived news link #3461
1 parent a093dcb commit 8325ac9

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

web/app/[locale]/(pages)/news/archive/[...slug]/page.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ import { Flags } from '@/sanity/helpers/datasetHelpers'
77
import type { PathType } from '@/sanity/queries/paths/getPaths'
88
import ArchivedNews from '@/templates/archivedNews/ArchivedNews'
99

10+
type Params = Promise<{ locale: string; slug: string[] }>
1011
//TODO types
11-
async function getArchivedPageData(params: any) {
12-
const { locale: routeLocale, slug: pagePathArray } = params
12+
async function getArchivedPageData(params: Params) {
13+
const { locale: routeLocale, slug: pagePathArray } = await params
1314
const locale = routeLocale === 'en-GB' ? 'en' : routeLocale
1415
if (!Flags.HAS_ARCHIVED_NEWS) return { notFound: true }
1516

16-
const pagePath = pagePathArray.join('/')
17+
const pagePath = pagePathArray?.join('/')
1718

1819
const archivedItems = archivedNews.filter(
1920
e => e.slug === `/news/archive/${pagePath}`,
@@ -32,7 +33,7 @@ async function getArchivedPageData(params: any) {
3233
export async function generateMetadata({
3334
params,
3435
}: {
35-
params: any
36+
params: Params
3637
}): Promise<Metadata> {
3738
const { locale, slug: pagePathArray } = await params
3839

web/i18n/routing.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const routing = defineRouting({
77
localePrefix: {
88
mode: 'as-needed',
99
prefixes: {
10+
'en-GB':"/en",
1011
'nb-NO': '/no',
1112
'pt-BR': '/pt',
1213
'es-AR': '/es',

0 commit comments

Comments
 (0)