# Add emoji reactions to a Ghost blog

> Add live emoji reactions to a Ghost blog: the loader through Code injection with no theme edit, a floating bar in post.hbs, an inline bar per post in index.hbs keyed to the slug. No Ghost integration to install.

A Ghost blog can show live emoji reactions on every post: the loader goes in through **Settings → Code injection** with no theme edit, a floating bar goes in `post.hbs`, and each post in `index.hbs` gets an inline bar keyed to its slug. The counts are keyed to the slug, so they survive a domain change.

## Before you start

You need a Tapbar: the reactions, the look, and a publishable key (`pk_live_…`). [Sign up](https://app.tapback.party), create a Tapbar with your site as an allowed site (add `http://localhost:*` too, to try it on a dev server), and open its **Embed** panel — the loader tag there already carries your key. Your AI agent can do this part for you; see [the last section](https://docs.tapback.party/install/ghost/#let-your-agent-do-it).

## Add the loader once

The loader goes in Settings → Code injection → Site Header (no theme edit; Ghost emits it through `{{ghost_head}}` on every page). It defines the `<tapback-bar>` element and starts every bar on the page, however many there are:

```html
<script type="module" async src="https://api.tapback.party/loader.js"
        data-key="pk_live_…" data-api="https://api.tapback.party"></script>
```

Swap `pk_live_…` for your own key, or paste the tag from the Embed panel as it is.

## Put a floating bar on each post

In `post.hbs`, add one bar with `layout="float"`, keyed to the same `{{slug}}`. It docks in the bottom corner wherever it sits in the markup, and it connects live, so readers see each other's reactions fall.

```handlebars
{{!-- post.hbs --}}
<tapback-bar entity="{{slug}}" layout="float"></tapback-bar>
```

## Add an inline bar to each post in the list

In `index.hbs`, inside `{{#foreach posts}}`, give every post its own bar, keyed to `{{slug}}`:

```handlebars
{{!-- index.hbs --}}
{{#foreach posts}}
  <article>
    <h2><a href="{{url}}">{{title}}</a></h2>
    <p>{{excerpt}}</p>
    <tapback-bar entity="{{slug}}" layout="inline" live="off"></tapback-bar>
  </article>
{{/foreach}}
```

`entity` names the counter. On a list page it has to be set by hand: a bar without it infers the list page's own URL, so every blurb would share one tally. Emit the same value the post page uses and a reaction on the blurb lands on the same count as one on the post.

`live="off"` shows each blurb's count without opening a live socket for it; the falling reactions stay on the post page. Bars that load together share one session request (up to 50 bars each), so a reader can reload a 50-post index about ten times a minute; past a few hundred bars on one page, paginate — see [Troubleshooting](https://docs.tapback.party/troubleshooting/#a-long-list-page-loses-some-bars).

## Different reactions per post (Plus)

By default every post shows your Tapbar's reactions. On [Plus](https://docs.tapback.party/plans/), a post can carry its own: add a named set in the console's Reactions card (say `spooky`, with a ghost and a skull), then point the post's bar at it.

```handlebars
{{!-- post.hbs --}}
<tapback-bar entity="{{slug}}" layout="float"{{#has tag="#spooky"}} set="spooky"{{/has}}></tapback-bar>
```

Ghost posts have no free-form fields, so use an internal tag: give the post the tag `#spooky` and add one `{{#has}}` check per set you use. `{{#has tag}}` matches internal tags only when you write the `#`. To list reactions on the bar instead of naming a set, use `reactions="ghost,skull"`; the keys have to be on the Tapbar or in its palette.

The list-page bars need no `set`. A `live="off"` bar that declares nothing never decides a post's reactions, so the post page's attribute decides them however readers arrive. The attribute applies the first time anyone loads the post; to change a post that's already live, use the ☰ picker in the console's **Pages** tab or the `set_entity_reactions` MCP tool. [Changing reactions on live pages](https://docs.tapback.party/live-pages/) has the full rules.

To choose a post's reactions by looking at the draft instead, add the [in-page picker](https://docs.tapback.party/authoring/) to the draft render: add the editor `<script>` and `<tapback-editor>` to `post.hbs` inside `{{#is "preview"}}…{{/is}}`, so they render only on a draft's preview, which already carries the post's real slug. Avoid a custom theme setting for this: it needs a `config.custom` entry in the theme's `package.json`, and while it's on, every visitor gets the editor and its authoring key. Ghost preview links work without a login, so anyone you share one with can read the authoring key in the page: share them only with people you'd trust with it, and rotate the key afterwards if one leaks.

## Check it works

1. Deploy to a site on the Tapbar's allowed list (or run your dev server, with `http://localhost:*` allowed). The bar only runs on allowed sites.
2. Open a post, tap a reaction, and reload. The count is still there.
3. Open the post list. That post's blurb shows the same count.

If no bar appears, check that the loader tag is in that page's `<head>` and that the page's origin is allowed — `www` and the bare domain are separate entries. [Troubleshooting](https://docs.tapback.party/troubleshooting/) maps each symptom to its fix.

## Notes for Ghost

- `{{slug}}` is host-independent and the simplest id here.
- `tag.hbs` and `author.hbs` have their own `{{#foreach posts}}` loops; add the same inline bar there if you want blurb counts on tag and author pages.
- On Ghost(Pro), editing `index.hbs` / `post.hbs` means downloading the active theme, changing it, and re-uploading the zip (or using GitHub theme sync). Ghost(Pro) Starter doesn't allow custom themes. There, put the loader and a `<tapback-bar layout="float"></tapback-bar>` together in Code injection → Site Footer: every page gets a floating bar keyed to its own URL, including the home page, tag pages and the 404 page, with no bars on the post list.

## Let your agent do it

Connect your agent to the Tapback MCP server — in Claude Code, `claude mcp add --transport http tapback https://api.tapback.party/mcp`; in Claude Desktop or claude.ai, **Add custom connector** with `https://api.tapback.party/mcp` — then paste this prompt:

```
Add Tapback live reactions to my Ghost site.

1. Connect to the Tapback MCP server at https://api.tapback.party/mcp and let me approve the sign-in.
2. Ask me for my site's domain, then create a Tapbar with that domain as its allowed site. Give it a heart, a star, and a smile to start — I can change these later.
3. Show me the embed snippet and tell me exactly where it goes in Ghost: the loader `<script>` in Settings → Code injection → Site Header (no theme edit; Ghost emits it through `{{ghost_head}}` on every page); an inline bar (`layout="inline"`, `live="off"`) in `index.hbs`, inside `{{#foreach posts}}`, keyed to `{{slug}}`; and a floating bar (`layout="float"`) in `post.hbs`, keyed to the same `{{slug}}`. The Ghost guide is at https://docs.tapback.party/install/ghost/ (as markdown: https://docs.tapback.party/install/ghost/index.md).
4. Once I've deployed, post a test reaction and read the count back so we know it's working.
```

[Set up with your agent](https://docs.tapback.party/agent-setup/) has the same prompt for every stack, with an optional step for the in-page picker. [Manage from your agent](https://docs.tapback.party/mcp/) lists everything the agent can reach.
