File tree Expand file tree Collapse file tree 1 file changed +35
-1
lines changed
Expand file tree Collapse file tree 1 file changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -158,7 +158,6 @@ This example is not using semantic keys instead the entire message will be used
158158
159159``` javascript
160160import {Link , useI18next } from ' gatsby-plugin-react-i18next' ;
161- import ' ./header.css' ;
162161import React from ' react' ;
163162
164163const Header = ({siteTitle}) => {
@@ -194,6 +193,41 @@ const Header = ({siteTitle}) => {
194193};
195194```
196195
196+ Or a more SEO friendly version using ` Link ` component
197+
198+ ``` javascript
199+ import {Link , useI18next } from ' gatsby-plugin-react-i18next' ;
200+ import PropTypes from ' prop-types' ;
201+ import React from ' react' ;
202+
203+ const Header = ({siteTitle}) => {
204+ const {languages , originalPath } = useI18next ();
205+ return (
206+ < header className= " main-header" >
207+ < h1 style= {{margin: 0 }}>
208+ < Link
209+ to= " /"
210+ style= {{
211+ color: ` white` ,
212+ textDecoration: ` none`
213+ }}>
214+ {siteTitle}
215+ < / Link>
216+ < / h1>
217+ < ul className= " languages" >
218+ {languages .map ((lng ) => (
219+ < li key= {lng}>
220+ < Link to= {originalPath} language= {lng}>
221+ {lng}
222+ < / Link>
223+ < / li>
224+ ))}
225+ < / ul>
226+ < / header>
227+ );
228+ };
229+ ```
230+
197231## Plugin Options
198232
199233| Option | Type | Description |
You can’t perform that action at this time.
0 commit comments