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

Setup Algolia documentation search and see how it works #1184

Closed
@acorncom

Description

@acorncom
- Copy the following CSS/JS snippets and add them to your page

<!-- at the end of the HEAD -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css" />
<!-- at the end of the BODY -->

<script
type="text/javascript"
src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script>

<script
type="text/javascript"> docsearch({
apiKey:
'70c6f2593b56f14e561a361d1b787a1e',

indexName: 'emberjs',
inputSelector: '### REPLACE ME ####',
algoliaOptions: {
'hitsPerPage': 5,
'facetFilters': '### REPLACE ME ####'
}
}); 
</script>

- Add a search input if you don't have any yet, and update the inputSelector value in the code snippet to a CSS selector that targets your input field.
- Add the logic to search only in the good set of tags:
if you want to search on guide 2.3.0 and the api:
'facetFilters': '(tags:api,tags:v2.3.0)'
If you want to search only in the api it will look like:
'facetFilters': '(tags:api)’

Possible tags are: “api”, “v1.10.0”, “v1.11.0”, “v1.12.0”, “v1.13.0”, “v2.0.0”, “v2.1.0”, “v2.2.0”, “v2.3.0” 

- Optionally customize the look and feel by following the DocSearch documentation

If this works well, I imagine we're going to want to add it to the API pages and the main website as well. Probably worth putting in a separate JS file that we'll aim to make global (and have it read the versions.js file for the appropriate version tag to use).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions