How to add an AI Agent to your Hugo website
This guide explains step-by-step how to add a simple client-side chatbot to a Hugo site using an OpenAI-compatible endpoint (for example, Azure OpenAI). It covers the HTML layout, JavaScript to call the API, and security notes for handling API keys. Summary Add a chatbot layout or partial to your theme or layouts/_default. Add a page (e.g. /ai-agent/) that uses the layout. Implement client-side JavaScript to call your AI provider. Keep secrets out of client-side code (preferred: proxy the requests server-side or use short-lived tokens). 1) Create the layout or partial Create layouts/_default/chatbot.html (or layouts/partials/chatbot.html) with a container, input box, and a small script. A working example is already included in this repository at layouts/_default/chatbot.html. ...