Skip to content

Commit 96f08e8

Browse files
committed
improve README.md
Signed-off-by: Dmitriy Nevzorov <jimmy.lugat@gmail.com>
1 parent 2bbcb08 commit 96f08e8

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ This example is not using semantic keys instead the entire message will be used
158158

159159
```javascript
160160
import {Link, useI18next} from 'gatsby-plugin-react-i18next';
161-
import './header.css';
162161
import React from 'react';
163162

164163
const 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 |

0 commit comments

Comments
 (0)