Home/Blog/html-website-guide
HTML Website Integration

How to Add an AI Chatbot to a Custom HTML Website

A step-by-step developer guide on embedding an autonomous, knowledge-grounded AI customer support assistant into static HTML5 websites, Bootstrap templates, and static site generators (Jekyll, Hugo, Astro).

Updated November 2026•Core Web Vitals Optimized•6 min read

Static HTML websites deliver unmatched speed, security, and low hosting costs. Whether your site is built with plain HTML/CSS, Tailwind, Bootstrap, or compiled via static site generators, adding an intelligent conversational agent shouldn't require bloated npm packages, complex backend proxies, or framework migrations.

Knogents provides a pure, vanilla JavaScript loader (embed.js) minified to under 12KB. It mounts asynchronously into your DOM, communicates with Neon pgvector vector stores via secure APIs, and renders with zero styling conflicts against your page CSS.

Universal HTML Snippet

Paste this snippet immediately before the closing </body> tag on your HTML pages:

<!-- Knogents Autonomous Support Agent --> <script src="https://knogents.com/embed.js" data-bot-id="YOUR_BOT_ID" data-display-mode="floating" async ></script>

Step-by-Step Installation Walkthrough

1

Create Your Assistant and Ingest Website Data

Log in to your Knogents dashboard and click Create Chatbot. Enter your bot name and navigate to the Knowledge Base tab. You can train your assistant using two simple sources:

  • Website Sitemaps: Enter your sitemap URL (e.g. https://example.com/sitemap.xml) to automatically crawl and index all public pages.
  • Files & Spreadsheets: Upload product spec PDFs, company FAQ documents, or Excel/CSV pricing tables.

Knogents chunks the content semantically, extracts headers, and indexes embeddings in under 2 minutes.

2

Retrieve Your Bot ID and Embed Script

Click the Deploy tab in the navigation bar. You will find your unique Bot ID (e.g., bot_abc123xyz) and the ready-to-copy HTML code block.

3

Embed Before </body> in Your HTML File

Open your project in VS Code, Sublime, or any text editor. Locate your index.html (or shared footer include in Jekyll/Hugo). Paste the script right before the closing </body> tag:

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>My Business Website</title> <link rel="stylesheet" href="styles.css" /> </head> <body> <header><h1>Welcome to Acme Corp</h1></header> <main><p>High-quality engineering solutions.</p></main> <!-- Knogents Chatbot Embed --> <script src="https://knogents.com/embed.js" data-bot-id="bot_98fbc12a" data-display-mode="floating" data-position="right" async ></script> </body> </html>
4

Configure Display Mode: Floating vs. Inline Container

Knogents supports two native display configurations:

Option A: Floating Launcher (Default)

Renders a discreet circular launcher button in the bottom corner of the viewport. Clicking it expands the chat window.

data-display-mode="floating"
Option B: Embedded Inline Panel

Renders the conversational interface directly inside an element on your contact or support page.

<div id="rag-inline-bot"></div>
5

Testing Locally over an HTTP Server

When testing locally, do not open the HTML file directly by double-clicking it (file:///C:/Users/.../index.html). Browsers restrict cross-origin script execution and network requests from file URIs. Instead, run a quick local HTTP server from your project folder:

# Using Node.js npx:
npx serve .

# Or using Python 3:
python -m http.server 8000

Open http://localhost:8000 in your browser. The assistant launcher will appear in the bottom-right corner!

Google Core Web Vitals & Performance Impact

Adding third-party scripts often degrades Google Lighthouse performance scores. Knogents is engineered specifically to eliminate performance penalties:

Cumulative Layout Shift (CLS = 0)The widget uses isolated absolute positioning and renders after layout paint without pushing DOM content.
Non-Blocking ExecutionThe async attribute ensures browser HTML parsing is never interrupted.
Terser-Minified BundleCompiled to under 12KB with zero external runtime dependencies (no React or jQuery injected into host).

Content Security Policy (CSP) Directives

If your HTML web server (Apache, Nginx, or Netlify/Vercel headers) serves a restrictive Content Security Policy, add the following domain directives to permit widget initialization and API communication:

Content-Security-Policy: script-src 'self' https://knogents.com; connect-src 'self' https://knogents.com; style-src 'self' 'unsafe-inline'; img-src 'self' https://knogents.com data:;

Frequently Asked Questions

Can I change the launcher position to the bottom-left?

Yes. Simply add data-position="left" to your embed script tag. The widget launcher will automatically dock on the bottom-left margin of the viewport.

Does Knogents work with static site generators like Jekyll, Hugo, and Astro?

Yes. In Jekyll, place the script in _includes/footer.html. In Hugo, place it in layouts/partials/footer.html. In Astro, place it in your base layout template right before </body>.

How do I style the chatbot colors to match my HTML theme?

You can set your primary brand hex color directly in the Knogents dashboard under Chatbot Settings, or supply data-accent-color="#0d9488" as an attribute on the script tag.

Deploy Your Chatbot in 3 Minutes

Create your free Knogents assistant, crawl your HTML website or sitemap, and copy your embed snippet today.

Recommended Business Solutions

Discover autonomous AI solutions powered by these installation techniques.

Related Guides & Tutorials

Continue exploring practical guides to embedding and training your chatbot.

24/7 STOREFRONT ASSISTANT

Ready to Build Your AI Agent?

Train an AI chatbot on your website URLs, PDFs, and spreadsheets in 2 minutes with verified factual accuracy.

Free tier includes 100 messages/mo
No credit card required
Under 20 KB vanilla script