Skip to content

Commit 5b689b0

Browse files
justinphstaylor
authored andcommitted
fix: add readme
1 parent 2552d14 commit 5b689b0

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,54 @@ import { HelmetProvider } from 'react-helmet-async';
126126
HelmetProvider.canUseDOM = false;
127127
```
128128

129+
## Prioritizing tags for SEO
130+
131+
It is understood that in some cases for SEO, certain tags should appear earlier in the HEAD. Using the `prioritizeSeoTags` flag on any `<Helmet>` component allows the server render of react-helmet-async to expose a method for prioritizing relevant SEO tags.
132+
133+
In the component:
134+
```
135+
<Helmet prioritizeSeoTags>
136+
<title>A fancy webpage</title>
137+
<link rel="notImportant" href="https://www.chipotle.com" />
138+
<meta name="whatever" value="notImportant" />
139+
<link rel="canonical" href="https://www.tacobell.com" />
140+
<meta property="og:title" content="A very important title"/>
141+
</Helmet>
142+
```
143+
144+
In your server template:
145+
146+
```
147+
<html>
148+
<head>
149+
${helmet.title.toString()}
150+
${helmet.priority.toString()}
151+
${helmet.meta.toString()}
152+
${helmet.link.toString()}
153+
${helmet.script.toString()}
154+
</head>
155+
...
156+
</html>
157+
```
158+
159+
Will result in:
160+
161+
```
162+
<html>
163+
<head>
164+
<title>A fancy webpage</title>
165+
<meta property="og:title" content="A very important title"/>
166+
<link rel="canonical" href="https://www.tacobell.com" />
167+
<meta name="whatever" value="notImportant" />
168+
<link rel="notImportant" href="https://www.chipotle.com" />
169+
</head>
170+
...
171+
</html>
172+
```
173+
174+
A list of prioritized tags and attributes can be found in [constants.js](./blob/master/src/constants.js).
175+
176+
129177
## License
130178

131179
Licensed under the Apache 2.0 License, Copyright © 2018 Scott Taylor

0 commit comments

Comments
 (0)