Configuration
Khoji is configured entirely through data-* attributes on the script tag. There is no dashboard to log into and no JSON config to host.
| Attribute | Default | What it does |
|---|---|---|
data-khoji | — | Marks the tag so Khoji can find its own config. Required. |
data-sitemap | /sitemap.xml | Path or URL of your sitemap. Sitemap-index files are followed automatically. |
data-accent | #e11d48 | Accent color for the button, highlights and links. Any CSS color. |
data-placeholder | Search this site… | Placeholder text of the search input. Use your language. |
data-max-pages | tier limit | Cap indexed pages below your tier limit (200 free / 2,000 paid). |
data-no-button | false | Set "true" to hide the floating button and trigger search yourself via window.Khoji.open(). |
data-key | — | Your license key on paid plans. Removes the badge and raises the page cap. |
data-model | MiniLM-L6-v2 | Advanced: swap the embedding model for any transformers.js-compatible feature-extraction model. |
JavaScript API
The widget exposes a small global for programmatic control:
window.Khoji.open() // open the search palette
window.Khoji.close() // close it
await window.Khoji.search(q) // run a query, get results as data
window.Khoji.reindex() // clear the cached index and rebuildWiring your own trigger
Hide the floating button and connect Khoji to your existing search icon:
<script src="https://khoji.aiskillhub.info/widget/khoji.js"
data-khoji data-no-button="true" async></script>
<script>
document.querySelector("#my-search-icon")
.addEventListener("click", () => window.Khoji.open());
</script>Styling
The widget renders inside a Shadow DOM, so your site's CSS never conflicts with it and vice versa. The palette follows the visitor's light/dark preference automatically; data-accent controls the brand color in both modes.