Skip to content

Commit fe962ee

Browse files
committed
embeddable snippet
1 parent 3aeb0af commit fe962ee

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/content/docs/autorag/how-to/nlweb.mdx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ These endpoints give both people and agents structured access to your content.
5151

5252
## Using It on Your Website
5353

54-
To integrate NLWeb search directly into your site:
54+
To integrate NLWeb search directly into your site you can:
5555

5656
1. Find your deployed Worker in the [Cloudflare dashboard](https://dash.cloudflare.com/):
5757
- Go to **Compute & AI** > **AutoRAG**.
@@ -60,6 +60,29 @@ To integrate NLWeb search directly into your site:
6060
2. Add a [custom domain](/workers/configuration/routing/custom-domains/) to your Worker (for example, ask.example.com)
6161
3. Use the `/ask` endpoint on your custom domain to power the search (for example, ask.example.com/ask)
6262

63+
You can also use the embeddable snippet to add a search UI directly into your website. For example:
64+
65+
```html
66+
<!-- Add css on head -->
67+
<link rel="stylesheet" href="https://ask.example.com/nlweb-dropdown-chat.css">
68+
<link rel="stylesheet" href="https://ask.example.com/common-chat-styles.css">
69+
70+
<!-- Add container on body -->
71+
<div id="docs-search-container"></div>
72+
73+
<!-- Include JavaScript -->
74+
<script type="module">
75+
import { NLWebDropdownChat } from 'https://ask.example.com/nlweb-dropdown-chat.js';
76+
77+
const chat = new NLWebDropdownChat({
78+
containerId: 'docs-search-container',
79+
site: 'https://ask.example.com',
80+
placeholder: 'Search for docs...',
81+
endpoint: 'https://ask.example.com'
82+
});
83+
</script>
84+
```
85+
6386
This lets you serve conversational AI search directly from your own domain, with control over how people and agents access your content.
6487

6588

0 commit comments

Comments
 (0)