Add AI to a Jekyll site
How do I add AI to a Jekyll blog?
Jekyll has no runtime, and on GitHub Pages it cannot even run custom plugins. Any AI feature that needs a secret key therefore needs a separate service. OneTag AI is that service, and because its key is public with a token budget, the integration is one line in an include.
This guide uses the default minima structure; other themes differ only in the include name.
Steps
Get a free key
From onetagai.com.
Add the tag to the head include
Copy the theme's
_includes/head.htmlinto your site if it is not there yet (bundle info minimashows where the theme lives), then add:<script src="https://onetagai.com/v1.js" data-key="YOUR_ONETAG_KEY"></script>Add the feature to the post layout
In
_layouts/post.html, after{{ content }}:<button id="tldr">TL;DR</button> <p id="summary"></p> <script type="module"> document.getElementById("tldr").onclick = async () => { document.getElementById("summary").textContent = await onetag.ask("Summarize in 3 bullets", document.querySelector(".post-content")); }; </script>Serve
bundle exec jekyll serve, open a post, click. On GitHub Pages, push and wait a minute.
Liquid and the key
Put onetag_key: ot_… in _config.yml and write data-key="{{ site.onetag_key }}" in the include. Because the key is public, it is fine in a committed config file; there is nothing to leak.
Comments-style widgets
Static blogs already load third-party widgets this way: Disqus, giscus, utterances all work as a script in an include. OneTag AI follows the same pattern, so it fits anywhere those do, including inside a conditional like {% if site.onetag_key %}.
Chirpy, just-the-docs and other themes
Chirpy: _includes/head.html. just-the-docs: _includes/head_custom.html. Minimal Mistakes: _includes/head/custom.html. The tag goes in the same place in each; the feature script goes in the layout that renders a post or a page.
Questions
Does this need a Jekyll plugin?
No, and that matters on GitHub Pages, which only allows a fixed set of plugins. The tag is plain HTML in an include.
Can I show the button only on some posts?
Yes: wrap the feature script in {% if page.ai %} and set ai: true in the front matter of posts that should have it.
Does the SDK conflict with jQuery or other scripts?
No. It defines a single global, onetag, and nothing else.
Is it safe to put the OneTag AI key in my page?
Yes, it is designed for that. The key can only spend its own token budget and cannot read or change anything on your account. On the Pro plan you can lock it to your domain so other sites cannot use it; free keys work from any page.
Does it cost anything?
A free key has 1,000,000 tokens with no monthly reset, enough for a few hundred summaries. Pro is $9.9 a month for 100,000,000 tokens a month and the domain lock.
Which model answers?
A fast, inexpensive model from OpenRouter, chosen for sub-second first tokens and good instruction following. You do not pick a model; the point is one tag that keeps working.
What happens to the text my visitors send?
It goes to the model and comes back. OneTag AI stores token counts per key for the quota and keeps no prompts, inputs or answers. The access log carries no IP addresses.
Related guides
- Add AI to a GitHub Pages site
- Add AI to a Hugo site
- Add a TL;DR summary button to blog posts
- Is it safe to put an AI API key in a static HTML page?
Get a free key by email, paste one tag, call onetag.ask. 1,000,000 tokens, no card.
Updated 2026-11-09. Something wrong or missing? Email support@odysseyx.app.