Skip to content

Commit a02139b

Browse files
committed
undo changes to algolia search
1 parent b843de7 commit a02139b

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

src/html.js

+7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ if (process.env.NODE_ENV === `production`) {
2020
}
2121
}
2222

23+
const JS_NPM_URLS = [
24+
'//unpkg.com/[email protected]/dist/cdn/docsearch.min.js',
25+
];
26+
2327
export default class HTML extends Component {
2428
render() {
2529
let css;
@@ -32,6 +36,8 @@ export default class HTML extends Component {
3236
);
3337
}
3438

39+
const js = JS_NPM_URLS.map(url => <script key={url} src={url} />);
40+
3541
return (
3642
<html lang="en">
3743
<head>
@@ -43,6 +49,7 @@ export default class HTML extends Component {
4349
/>
4450
<link rel="icon" href="/favicon.ico" />
4551
{this.props.headComponents}
52+
{js}
4653
{css}
4754
</head>
4855
<body>

src/layouts/index.js

+7-9
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,13 @@ import 'css/algolia.css';
3030

3131
class Template extends Component {
3232
componentDidMount() {
33-
loadScript(algoliaURL).then(() => {
34-
// Initialize Algolia search.
35-
// TODO Is this expensive? Should it be deferred until a user is about to search?
36-
// eslint-disable-next-line no-undef
37-
docsearch({
38-
apiKey: '36221914cce388c46d0420343e0bb32e',
39-
indexName: 'react',
40-
inputSelector: '#algolia-doc-search',
41-
});
33+
// Initialize Algolia search.
34+
// TODO Is this expensive? Should it be deferred until a user is about to search?
35+
// eslint-disable-next-line no-undef
36+
docsearch({
37+
apiKey: '36221914cce388c46d0420343e0bb32e',
38+
indexName: 'react',
39+
inputSelector: '#algolia-doc-search',
4240
});
4341
}
4442

src/site-constants.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,5 @@
1515
const urlRoot = 'https://reactjs.org';
1616
const version = '16.0.0';
1717
const babelURL = '//unpkg.com/[email protected]/babel.min.js';
18-
const algoliaURL = '//unpkg.com/[email protected]/dist/cdn/docsearch.min.js';
1918

20-
export {urlRoot, version, babelURL, algoliaURL};
19+
export {urlRoot, version, babelURL,};

0 commit comments

Comments
 (0)