Skip to content

Commit e70986d

Browse files
committed
add filter for hreflangs meta tags
1 parent 0b58593 commit e70986d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/lib/processMetadata.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ export default async function processMetadata(
2727
alternates: {
2828
canonical: url,
2929
languages: Object.fromEntries(
30-
page.translations?.map((t) => [
31-
t?.language,
32-
[BASE_URL, t?.language !== DEFAULT_LANG && t?.language, t?.slug]
33-
.filter(Boolean)
34-
.join('/'),
35-
]) || [],
30+
page.translations
31+
?.filter((t) => !!t.language)
32+
?.map((t) => [
33+
t?.language,
34+
[BASE_URL, t?.language !== DEFAULT_LANG && t?.language, t?.slug]
35+
.filter(Boolean)
36+
.join('/'),
37+
]) || [],
3638
),
3739
types: {
3840
'application/rss+xml': '/blog/rss.xml',

0 commit comments

Comments
 (0)