Skip to content

Commit c6f88af

Browse files
committed
filter valid locales using isLocaleValidISO639_1 for alternates
1 parent f3bdc54 commit c6f88af

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/lib/utils/metadata.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { getTranslations } from "next-intl/server"
33

44
import { DEFAULT_OG_IMAGE, SITE_URL } from "@/lib/constants"
55

6+
import { isLocaleValidISO639_1 } from "./translations"
67
import { getFullUrl } from "./url"
78

89
import { routing } from "@/i18n/routing"
@@ -71,10 +72,9 @@ export const getMetadata = async ({
7172
languages: {
7273
"x-default": xDefault,
7374
...Object.fromEntries(
74-
routing.locales.map((locale) => [
75-
locale,
76-
getFullUrl(locale, slugString),
77-
])
75+
routing.locales
76+
.filter(isLocaleValidISO639_1)
77+
.map((locale) => [locale, getFullUrl(locale, slugString)])
7878
),
7979
},
8080
},

0 commit comments

Comments
 (0)