Skip to content

[Documentation] Add a nice search experience in the website #1104

Closed
@s-pace

Description

@s-pace

👋 jQuery team,

Following #227 that is lost in threads, I am following up and waiting fro feedback.

As web developers, we've all used jQuery in our career and we'll be forever grateful for how it changed the web development landscape for the better. But with so many versions along the years, we understand it can sometimes be hard to navigate into the documentation.

I'm working at Algolia on the a project called DocSearch which goal is to enhance documentation websites with exhaustive, fast and relevant search. You might have seen DocSearch live already on websites like Bootstrap, ESLint or Babel.

We put together a demo of what DocSearch on the jQuery website could look like here. Feel free to try it and let us know what you think.

demo of DocSearch + jQuery

The way DocSearch works is by crawling your content, pushing the results into an Algolia index, and then requesting this index directly from the website front-end through JavaScript.

We'll take care of crawling your website and populating the Algolia index with the latest changes every 24h for you. You don't need to change anything to your deployment process. The only thing you need to add are the following CSS and JS snippets that will bind the dropdown to your searchbox.

<!-- 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: '3cfde9aca378c8aab554d5bf1b23489b',
  indexName: 'jquery',
  inputSelector: '[name="s"]',
  debug: false // Set debug to true if you want to inspect the dropdown
});
</script>

The inputSelector option should be set to a CSS selector that target your search input. Feel free to update it if this one is not specific enough.

We built DocSearch with the idea of giving back to the Open-Source community. This is why your crawling configuration is available on GitHub if you want to change it. We also have our own documentation to help you tweak the dropdown to your needs. You'll also have access to analytics on the most searched terms or those with no results. All of this is of course entirely free.

Would that be something you'd be interested in? If so, we'd be happy to work on integrating it through a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions