Skip to content

Commit 56922be

Browse files
jamiehensonclaude
andcommitted
fix: add alternate language link support to Head component
Add alternateLanguageLinks prop to Head component to support proper SEO signaling for language variants. This renders <link rel="alternate" hrefLang="..."> tags for each available language option, following SEO best practices for multi-language content. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 5fc4795 commit 56922be

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/components/Head.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
11
import React from 'react';
22
import { Helmet } from 'react-helmet';
33

4+
export type AlternateLanguageLink = {
5+
lang: string;
6+
href: string;
7+
};
8+
49
export const Head = ({
510
title,
611
canonical,
712
description,
813
metaTitle,
914
keywords,
15+
alternateLanguageLinks,
1016
}: {
1117
title: string;
1218
canonical: string;
1319
description: string;
1420
metaTitle?: string;
1521
keywords?: string;
22+
alternateLanguageLinks?: AlternateLanguageLink[];
1623
}) => (
1724
<Helmet>
1825
<title>{metaTitle || title}</title>
1926
<meta property="og:title" content={title} />
2027
<meta property="twitter:title" content={title} />
2128
<link rel="canonical" href={canonical} />
29+
{alternateLanguageLinks?.map((alt) => <link key={alt.lang} rel="alternate" hrefLang={alt.lang} href={alt.href} />)}
2230
<meta name="description" content={description} />
2331
<meta property="og:description" content={description} />
2432
<meta name="twitter:description" content={description} />

0 commit comments

Comments
 (0)