---
title: "Embed a thread"
description: "Connect an HTML page, a static site or a CMS. The same site and page keys open the same discussion."
---

> Documentation Index
> Fetch the complete documentation index at: https://blua.pwp.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Embed a thread

## Gather three values

- `endpoint` is the public Blua gateway. Replace `https://blua.example` throughout the examples with your own address.
- Create the `site-key` in **Settings → Sites**. Add the website serving the article to its allowed origins, one origin per line.
- `page-key` identifies the article. Use an ID that survives title changes, tracking parameters and translated URLs. Assign separate keys if each translation should have its own thread.

## HTML

```html
<script type="module" src="https://blua.example/embed.js"></script>
<blua-comments
  endpoint="https://blua.example"
  site-key="garden"
  page-key="spring-swallows"
  locale="en"
></blua-comments>
```

Load the module once per page and place the element where the thread belongs. Update `page-key` when client-side navigation changes the article. See [framework integration](/docs/embed/frameworks) for components and SSR.

## iframe

Use the gateway’s `/embed` document in an HTML or iframe block in your CMS. The `origin` referrer policy lets the gateway verify the parent site.

```html
<iframe
  id="discussion"
  title="Article comments"
  src="https://blua.example/embed?siteKey=garden&amp;pageKey=spring-swallows&amp;locale=en"
  referrerpolicy="origin"
  loading="lazy"
  height="640"
  style="width: 100%; border: 0"
></iframe>
```

A fixed-height iframe scrolls. If the host allows module scripts, the gateway ships a helper that follows the thread height. Call the returned cleanup function when a single-page application unmounts the frame.

```html
<script type="module">
  import { connectBluaFrame } from 'https://blua.example/embed/host.js';
  const disconnect = connectBluaFrame(document.querySelector('#discussion'));
</script>
```

If the host strips referrers, add the URL-encoded, registered `parentOrigin` to the iframe URL. Allow the gateway in the host’s `frame-src` policy.

Source: https://blua.pwp.sh/docs/en/embed/
