Get started with docsearch-js CDN

MIT licensed

Docsearch-js is a library that enables instant code documentation search within source code.

Tags:
  • doc
  • search

Stable version

Copied!

How to start using docsearch-js CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with docsearch-js CDN - cdnhub.io</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/docsearch.min.css" />
  <script src="https://cdn.cdnhub.io/docsearch-js/3.6.0/umd/index.js"></script>
  <script>
    // Initialize Docsearch
    const config = {
      apiKey: 'YOUR_ALGOLIA_API_KEY',
      indexName: 'YOUR_INDEX_NAME',
      inputSelector: '.documentation-input',
      containerSelector: '.documentation-container',
      autofocus: true,
    };

    const docsearch = new Algolia.Docsearch(config);

    // Initialize the search
    docsearch.init();
  </script>
</head>
<body>
  <input type="text" class="documentation-input" placeholder="Search documentation..." />
  <div class="documentation-container"></div>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!

All versions