Documentation · Getting Started
Add Threadly comments to your site
Threadly is a no-login comment widget — a drop-in alternative to Disqus. You add two lines of HTML to a page and a comment thread appears. Visitors comment without signing up; you moderate from your dashboard.
There’s nothing to install and no JavaScript to write.
1. Get your site key
Register a site. You get two things:
- Public key — a non-secret id for your site (looks like
pk_J1GWzTik-…). Safe to put in your page’s HTML. - Origin — the only domain allowed to use that key (e.g.
https://yourblog.com). Nobody can copy your key onto a different site and use it.
2. The allowed origin
The allowed origin is the scheme + host (+ port) of your site, exactly as a visitor sees it in their address bar. Three rules keep this painless:
- Use the form visitors actually type.
https://yourblog.com,http://localhost:3000,https://blog.example.org:8443— all are valid origins. Just match what sits in the address bar. - We strip a trailing slash and any path you pass.
https://yourblog.com/,https://yourblog.com/blog, andhttps://yourblog.com?q=1all store ashttps://yourblog.com— so a paste-straight-from-the-address-bar is fine. https://yourblog.comandhttps://www.yourblog.comare different origins. Pick the one your pages actually serve from; the API does the rest.
Invalid input (no scheme, garbage like yourblog.com, or odd schemes like ftp://…) bounces back immediately as a clear error.
3. Drop in the embed
Put this where you want comments to appear (e.g. at the bottom of a blog post):
<div
data-site="pk_your_public_key"
data-thread="my-first-post"
data-api="https://threadly-api.threadly.workers.dev"
></div>
<script
src="https://threadly-widget.pages.dev/widget/0.5.4/widget.js"
defer
></script>That’s it. The script finds the <div>, loads the thread’s comments, and shows a comment box underneath.
4. Attributes
| Attribute | What it is | Example |
|---|---|---|
| data-site | Your public key (which site this is) | pk_J1GWzTik-… |
| data-thread | A unique id for this page | my-first-post |
| data-api | The Threadly API URL | https://threadly-api.…workers.dev |
5. Choosing data-thread
data-thread is how Threadly keeps each page’s comments separate. Every page needs its own stable value — changing it hides that page’s existing comments. A database id is best; slugs work too, but treat renaming a published post as a breaking change.
If your site has comments under multiple top-level paths, namespace the id per section so they never merge:
// app/blog/[slug]/page.tsx
import { Threadly } from "@/components/threadly";
export default async function Post({
params,
}: {
params: Promise<{ slug: string }>;
}) {
const { slug } = await params;
return (
<article>
{/* … */}
<Threadly thread={`blog-${slug}`} />
</article>
);
}/blog/test-blog → data-thread="blog-test-blog". /articles/intro → data-thread="articles-intro".
What doesn’t work:
- Same id across two pages — their comments merge into one thread.
data-threadnot set — the widget doesn’t mount. Empty or whitespace-only is treated the same.