Place meta charset output at top of head
See original GitHub issueAccording to the HTML5 specification,
The element containing the character encoding declaration must be serialized completely within the first 1024 bytes of the document.
However, as far as I can tell, react-helmet makes no attempt to output any configured <meta charset='...'>
tag as the first thing in the <head>
element; in fact it appears to always be output after the <title>
. If other code is also writing to the <head>
(e.g. styled-components), this could push the charset specification well past that 1024 byte cutoff.
Is it possible to modify the output order of the head elements produced by react-helmet?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:11
- Comments:6 (1 by maintainers)
Top Results From Across the Web
HTML meta charset Attribute - W3Schools
The charset attribute specifies the character encoding for the HTML document. The HTML5 specification encourages web developers to use the UTF-8 character ......
Read more >Function to place meta charset="UTF-8" first position in head
I need it to be at the begging of the head section. How do I get <meta charset=“UTF-8”> to be inserted in the...
Read more >HTML meta charset Attribute - Dofactory
The charset attribute specifies what character encoding the page uses. Browsers need to know what character set to use to be able to...
Read more >HTML | <meta> charset Attribute - GeeksforGeeks
Attribute Values: It contains the value i.e character_set which specify the character encoding for the HTML document. Values: UTF-8: It specify ...
Read more >Set charset meta tag with JavaScript - html - Stack Overflow
and following @sebastien-lorber suggestion, will output <meta charset="UTF-8">. as first child element of head.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Have anyone solved this issue ?
@tinynumbers on the server side, you can control the ordering of groups of head information (i.e. meta tags before title tag before link tags). And the ordering of tags should stay the same order they were given as props to Helmet. On the client, you’re right, the code doesn’t try to maintain this order. We can look into fixing that. Thanks!