Use a version-specific search
Summary:Algolia is now indexing each version of the docs, let's use it :) Closes https://github.com/facebook/react-native/pull/6385 Differential Revision: D3031426 Pulled By: vjeux fb-gh-sync-id: f06855bda304f491aaac28663c2d24b142a80d75 shipit-source-id: f06855bda304f491aaac28663c2d24b142a80d75
This commit is contained in:
parent
f5a349021d
commit
4e31148726
|
@ -17,6 +17,7 @@ var Site = React.createClass({
|
|||
render: function() {
|
||||
const path = Metadata.config.RN_DEPLOYMENT_PATH;
|
||||
const version = Metadata.config.RN_VERSION;
|
||||
const algoliaVersion = version === 'next' ? 'master' : version;
|
||||
var basePath = '/react-native/' + (path ? path + '/' : '');
|
||||
var title = this.props.title ? this.props.title + ' – ' : '';
|
||||
var currentYear = (new Date()).getFullYear();
|
||||
|
@ -68,6 +69,7 @@ var Site = React.createClass({
|
|||
</div>
|
||||
|
||||
<div id="fb-root" />
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script>
|
||||
<script dangerouslySetInnerHTML={{__html: `
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
|
@ -79,8 +81,14 @@ var Site = React.createClass({
|
|||
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)
|
||||
){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";
|
||||
fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
|
||||
|
||||
docsearch({
|
||||
apiKey: '2c98749b4a1e588efec53b2acec13025',
|
||||
indexName: 'react-native-versions',
|
||||
inputSelector: '#algolia-doc-search',
|
||||
algoliaOptions: { facetFilters: [ "tags:${algoliaVersion}" ] }
|
||||
});
|
||||
`}} />
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script>
|
||||
<script src="js/scripts.js" />
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -42,11 +42,4 @@
|
|||
modal.classList.remove('modal-open');
|
||||
}
|
||||
|
||||
// Algolia
|
||||
docsearch({
|
||||
apiKey: 'e3d767b736584dbe6d4c35f7cf7d4633',
|
||||
indexName: 'react-native',
|
||||
inputSelector: '#algolia-doc-search'
|
||||
});
|
||||
|
||||
}());
|
||||
|
|
Loading…
Reference in New Issue