Mintlify runs every .js file in your docs folder on every page. You add the widget with one small file.

Before you start

  • Your website widget. Kelu makes one for you when you create a knowledge base. Its Install tab shows these steps with your widget id and key already in the code.
  • Your docs site on the widget’s Sites it works on list (Install tab).
  • Custom JavaScript on your Mintlify plan. It is a paid Mintlify feature.

Add the widget

1

Create a JavaScript file

Add a file named kelu-widget.js to the folder that holds docs.json.
2

Paste the loader

Mintlify has no place for a script tag, so the file adds the tag itself:
kelu-widget.js
(function () {
  if (document.getElementById("kelu-widget")) return;
  var s = document.createElement("script");
  s.id = "kelu-widget";
  s.async = true;
  s.src = "https://widget.kelu.dev/kelu-widget.js";
  s.setAttribute("data-widget-id", "YOUR_WIDGET_ID");
  s.setAttribute("data-client-key", "kl_pk_...");
  document.head.appendChild(s);
})();
Replace YOUR_WIDGET_ID and kl_pk_... with the values from your widget’s snippet.
3

Preview and push

Run mint dev to check it locally, then commit and push. Mintlify redeploys with the file.

Check it works

Open any page. A round icon button appears in the bottom-right corner, with the tooltip Ask AI. Ask a question and check that the answer lists its Sources. Nothing there? See Troubleshooting. Turn on Replace my site’s search on the widget’s Search & opening tab, and Kelu takes over Mintlify’s search. No change to kelu-widget.js is needed. To set it in the file instead, add this line before document.head.appendChild(s):
kelu-widget.js
s.setAttribute("data-replace-site-search", "true");
What happens:
  • The search box in the top bar opens Kelu on the Search tab. So does the search icon on phones.
  • Cmd+K (Ctrl+K on Windows and Linux) opens Kelu on the Search tab too.
  • Mintlify’s own search dialog no longer opens.
The Search tab is turned on for you. See Search mode for what it shows.
Without this setting, Cmd+K opens Kelu and Mintlify’s search box opens Mintlify’s search. To give Cmd+K back to Mintlify, turn off Open with Cmd/Ctrl+K on the widget’s Search & opening tab. To follow Mintlify’s dark mode, set Dark-mode selector to html.dark on the Look tab (choose Follow my site).