-
Notifications
You must be signed in to change notification settings - Fork 7.6k
/
html.js
62 lines (55 loc) · 1.33 KB
/
html.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* @emails react-core
*/
'use strict';
import React, {Component} from 'react';
let stylesStr;
if (process.env.NODE_ENV === `production`) {
try {
stylesStr = require(`!raw-loader!../public/styles.css`);
} catch (e) {
console.error(e);
}
}
const JS_NPM_URLS = [
'//unpkg.com/[email protected]/dist/cdn/docsearch.min.js',
];
export default class HTML extends Component {
render() {
let css;
if (process.env.NODE_ENV === 'production') {
css = (
<style
id="gatsby-inlined-css"
dangerouslySetInnerHTML={{__html: stylesStr}}
/>
);
}
const js = JS_NPM_URLS.map(url => <script key={url} src={url} />);
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<link rel="icon" href="/favicon.ico" />
{this.props.headComponents}
{js}
{css}
</head>
<body>
<div
id="___gatsby"
dangerouslySetInnerHTML={{__html: this.props.body}}
/>
{this.props.postBodyComponents}
</body>
</html>
);
}
}