Skip to content

Commit 88b509c

Browse files
authored
Merge pull request #12324 from ethereum/x-default-hreflang
Add x-default hreflang
2 parents 2c69d8f + 108fbb8 commit 88b509c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/PageMetadata.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { getOgImage } from "@/lib/utils/metadata"
66
import { filterRealLocales } from "@/lib/utils/translations"
77
import { getFullUrl } from "@/lib/utils/url"
88

9-
import { SITE_URL } from "@/lib/constants"
9+
import { DEFAULT_LOCALE, SITE_URL } from "@/lib/constants"
1010

1111
type NameMeta = {
1212
name: string
@@ -52,6 +52,9 @@ const PageMetadata = ({
5252
const url = getFullUrl(locale, path)
5353
const canonical = canonicalUrl || url
5454

55+
// Set x-default URL for hreflang
56+
const xDefault = getFullUrl(DEFAULT_LOCALE, path)
57+
5558
/* Set fallback ogImage based on path */
5659
const ogImage = image || getOgImage(slug)
5760

@@ -85,6 +88,7 @@ const PageMetadata = ({
8588
/>
8689
))}
8790
<link rel="canonical" key={canonical} href={canonical} />
91+
<link rel="alternate" hrefLang="x-default" href={xDefault} />
8892
{locales.map((loc) => (
8993
<link
9094
key={loc}

0 commit comments

Comments
 (0)