Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding search to the documentation #527

Closed
Haroenv opened this issue Jan 9, 2018 · 7 comments · Fixed by #530
Closed

Adding search to the documentation #527

Haroenv opened this issue Jan 9, 2018 · 7 comments · Fixed by #530

Comments

@Haroenv
Copy link
Contributor

Haroenv commented Jan 9, 2018

Hey! I noticed that the website doesn't have search, as you might have seen on other websites, it's pretty simple to add DocSearch to a website like these for free. Some examples:

Fair disclosure: I work for Algolia

@tkh44
Copy link
Member

tkh44 commented Jan 9, 2018

I would love to have this.

@tkh44
Copy link
Member

tkh44 commented Jan 9, 2018

I started the process of getting indexed.

@emmatown
Copy link
Member

emmatown commented Jan 9, 2018

A few days ago I signed up for it and I just got an email asking if I was the owner and if I can add a JS snippet which I just replied to.

@Haroenv
Copy link
Contributor Author

Haroenv commented Jan 9, 2018

I see both of your emails, we’ll index it tomorrow 😄

@s-pace
Copy link

s-pace commented Jan 10, 2018

​Glad to know that you are eager to implement it.

​In such purpose, I will need you to add some specific classe names to some relevant DOM elements of your website. We will use this web page as an example.

​Could you add a steady class name, e.g. docSearch-content to the following highlighted element:

image
​Dom element that must have a steady class name like docSearch-content. Matching XPATH selector: //*[@id="___gatsby"]/div/div/div[2]/div/div/div[3]/div/div[1]

​Could you add also another classe name, e.g. docSearch-lvl1 to the following active one:

image
DOM "curent" element that must have a steady class name like docSearch-lvl1.

​Finally the following element would need a specific class too like docSearch-lvl0:

image

​DOM "curent" element's parent that must have a steady class name like docSearch-lvl0.

​Those classes will help use to extract the right context of your documents and hence increase the relevancy of your search experience.

​Last but not least, if you could add a sitemap, it would be a safer way to ensure that we don't miss any document. Otherwise, we will crawl your web site in order to discover it.

​Feel free to ping us if you need any further detail or help.

@emmatown
Copy link
Member

emmatown commented Jan 10, 2018

@s-pace Just added those classes and a sitemap.

@s-pace
Copy link

s-pace commented Jan 10, 2018

Congratulations, your search is now ready!
I've successfully configured the underlying crawler and it will now run every 24h.

You're now a few steps away from having it working on your website:

  • 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/npm/docsearch.js@2/dist/cdn/docsearch.min.css" /> 
<!-- at the end of the BODY --> 
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script> 
<script type="text/javascript"> docsearch({apiKey: 'd160789a17f10ba962c4bce1b298fbbb',indexName: 'emotion_sh',inputSelector: '### REPLACE ME ####',debug: false // Set debug to true if you want to inspect the dropdown 
}); 
</script> 

Feel free to get back to us if you have any issues or questions regarding the integration.
We'd also be happy to get your feedback and thoughts about DocSearch - so we can continue to improve it.

Have a nice day :)

@emmatown emmatown self-assigned this Jan 10, 2018
@emmatown emmatown mentioned this issue Jan 11, 2018
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants