Skip to content
This repository was archived by the owner on Jun 3, 2019. It is now read-only.

Commit 83d533a

Browse files
ambarctrlplusb
authored andcommitted
put meta[charset] before title (#497)
1 parent 152a260 commit 83d533a

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

server/middleware/reactApplication/ServerHTML.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,13 @@ function ServerHTML(props) {
4343
const { asyncComponentsState, helmet, nonce, reactAppString } = props;
4444

4545
// Creates an inline script definition that is protected by the nonce.
46-
const inlineScript = body => (
47-
<script nonce={nonce} type="text/javascript" dangerouslySetInnerHTML={{ __html: body }} />
48-
);
46+
const inlineScript = body =>
47+
<script nonce={nonce} type="text/javascript" dangerouslySetInnerHTML={{ __html: body }} />;
4948

5049
const headerElements = removeNil([
50+
...ifElse(helmet)(() => helmet.meta.toComponent(), []),
5151
...ifElse(helmet)(() => helmet.title.toComponent(), []),
5252
...ifElse(helmet)(() => helmet.base.toComponent(), []),
53-
...ifElse(helmet)(() => helmet.meta.toComponent(), []),
5453
...ifElse(helmet)(() => helmet.link.toComponent(), []),
5554
ifElse(clientEntryAssets && clientEntryAssets.css)(() => stylesheetTag(clientEntryAssets.css)),
5655
...ifElse(helmet)(() => helmet.style.toComponent(), []),
@@ -83,7 +82,9 @@ function ServerHTML(props) {
8382
process.env.BUILD_FLAG_IS_DEV === 'true' && config('bundles.client.devVendorDLL.enabled'),
8483
)(() =>
8584
scriptTag(
86-
`${config('bundles.client.webPath')}${config('bundles.client.devVendorDLL.name')}.js?t=${Date.now()}`,
85+
`${config('bundles.client.webPath')}${config(
86+
'bundles.client.devVendorDLL.name',
87+
)}.js?t=${Date.now()}`,
8788
),
8889
),
8990
ifElse(clientEntryAssets && clientEntryAssets.js)(() => scriptTag(clientEntryAssets.js)),
@@ -93,10 +94,16 @@ function ServerHTML(props) {
9394
return (
9495
<HTML
9596
htmlAttributes={ifElse(helmet)(() => helmet.htmlAttributes.toComponent(), null)}
96-
headerElements={headerElements.map((x, idx) => (
97-
<KeyedComponent key={idx}>{x}</KeyedComponent>
98-
))}
99-
bodyElements={bodyElements.map((x, idx) => <KeyedComponent key={idx}>{x}</KeyedComponent>)}
97+
headerElements={headerElements.map((x, idx) =>
98+
(<KeyedComponent key={idx}>
99+
{x}
100+
</KeyedComponent>),
101+
)}
102+
bodyElements={bodyElements.map((x, idx) =>
103+
(<KeyedComponent key={idx}>
104+
{x}
105+
</KeyedComponent>),
106+
)}
100107
appBodyString={reactAppString}
101108
/>
102109
);

shared/components/DemoApp/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@ function DemoApp() {
2121
<div style={{ padding: '2rem' }}>
2222
<Helmet>
2323
<html lang="en" />
24-
<title>{config('htmlPage.defaultTitle')}</title>
24+
<meta charSet="utf-8" />
2525
<meta name="application-name" content={config('htmlPage.defaultTitle')} />
2626
<meta name="description" content={config('htmlPage.description')} />
27-
<meta charSet="utf-8" />
2827
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
2928
<meta name="viewport" content="width=device-width, initial-scale=1" />
3029
<meta name="msapplication-TileColor" content="#2b2b2b" />
3130
<meta name="msapplication-TileImage" content="/favicons/mstile-144x144.png" />
3231
<meta name="theme-color" content="#2b2b2b" />
32+
<title>
33+
{config('htmlPage.defaultTitle')}
34+
</title>
3335
{/*
3436
A great reference for favicons:
3537
https://github.com/audreyr/favicon-cheat-sheet

0 commit comments

Comments
 (0)