Skip to main content
Guides

How to Add AI Search to a Documentation Site

Cortexvia Engineering09 Sept 20264 min read

Documentation search has a familiar failure. The reader types "rotate API key", the search box matches pages containing "rotate" and pages containing "key", and returns the changelog, the glossary, and a page about key concepts. The page that actually says how to rotate a key is fourth, titled "Credential management".

AI search fixes the mismatch between how readers ask and how writers title. The panel reads the question, retrieves the passages that answer it, and replies in a sentence or two drawn from your pages. This guide adds one to a docs site.

What you need

  • A documentation site where you can add a script tag: a static site generator, a docs platform with custom code, a WordPress or Webflow site, or a React or Next.js app
  • The docs pages you want searchable, as URLs, plus any PDFs that only exist as files
  • A Cortexvia chatbot with those pages as sources; the free plan is enough to try it on one section

Step 1: Choose the pages deliberately

Do not index everything. Add:

  • Getting-started and quickstart pages
  • Reference pages: configuration, options, limits, error codes
  • Troubleshooting pages
  • The current FAQ

Leave out the changelog archive, blog posts, and any page describing behaviour that has changed. A retired option will be returned with complete confidence. The training guide explains why this selection matters more than any setting.

Step 2: Create the chatbot and set the handoff

Create a chatbot, add the pages as website sources, and upload any PDFs. Set the response style to concise for reference material. Add your support email or community link as a support contact so a reader whose question is not covered has a next step.

Step 3: Place the inline panel

The chat mode renders the panel inside any container, so it can sit where your search box does. The snippet:

html
<link rel="stylesheet" href="https://cdn.cortexvia.in/chatbotsdk-web.css" />
<script src="https://cdn.cortexvia.in/chatbotsdk-web.iife.js"></script>
<div id="cv-chat" style="height: 480px"></div>
<script>
  window.ChatbotSDK.mount("#cv-chat", {
    chatbotKey: "ctx-cb-xxxxxxxxxxxxxxxx",
    config: { mode: "chat" }
  });
</script>

The container needs a height; inline mode fills it. Put the container at the top of your docs home page or in a dedicated "Ask the docs" page linked from the header. If you also want a floating launcher on every page, mount a second instance with mode: "chatbot" from your layout; the AI website search page shows both.

On React or Next.js docs sites, mount from an effect with cleanup so route changes do not duplicate the panel. The React and Next.js guides have the code.

Step 4: Test with real searches

Pull the last month of search queries from your existing search box or analytics. Ask the top twenty in the panel, phrased exactly as readers typed them. Score each answer right, thin, or not covered.

  • Right: done.
  • Thin: the page that should answer it is vague. Rewrite the page.
  • Not covered: the page does not exist or was not added. Add it.

That list of thin and missing answers is also your documentation backlog.

Step 5: Keep it current with releases

Add "re-add changed docs pages to the chatbot" to the release checklist, next to "update the changelog". There is no retraining step; re-adding a page replaces its old passages. Teams that skip this have a panel that confidently describes the previous version.

What readers notice

  • They type a question and get a sentence, not a list.
  • Synonyms work: "rotate", "regenerate", and "change" a key all land on the same answer.
  • When the docs do not cover something, the panel says so and points to support, instead of returning a page that mentions the word.

Frequently asked questions

Does this replace my search box? For most readers, yes; for power users who want to browse results, keep a link to the old search. Many teams run the AI panel prominently and the keyword search as a secondary link.

Can it answer from code samples? It answers from the text of your pages, including code blocks. Questions like "what does the mount call look like" return the snippet from the page that contains it.

How does it handle versioned docs? Create one chatbot per supported version, each trained on that version's pages, and mount the matching one on each version's site. Mixing versions in one chatbot produces answers that are right for one and wrong for the other.

Ready to Get Started?

Build your chatbot in minutes with Cortexvia. Free tier available.