diff --git a/docs/guides-search.md b/docs/guides-search.md index 2038438d15..e7c6d64055 100644 --- a/docs/guides-search.md +++ b/docs/guides-search.md @@ -29,7 +29,10 @@ const siteConfig = { ... algolia: { ... - algoliaOptions: '{ facetFilters: [ "tags:VERSION" ], hitsPerPage: 5 }' + algoliaOptions: { + facetFilters: [ "tags:VERSION" ], + hitsPerPage: 5 + } }, } ``` diff --git a/lib/core/Site.js b/lib/core/Site.js index 4424f717b4..e68d6ca954 100644 --- a/lib/core/Site.js +++ b/lib/core/Site.js @@ -99,9 +99,11 @@ class Site extends React.Component { apiKey: '${this.props.config.algolia.apiKey}', indexName: '${this.props.config.algolia.indexName}', inputSelector: '#search_input_react', - algoliaOptions: '${this.props.config.algolia.algoliaOptions + algoliaOptions: ${ + JSON.stringify(this.props.config.algolia.algoliaOptions) .replace("VERSION", this.props.version || latestVersion) - .replace("LANGUAGE", this.props.language)}' + .replace("LANGUAGE", this.props.language) + } }); ` }}