Skip to content

Celebrating our new site: 30% off everything with code , until Dec 1.

Bright Themes

Subscribe forms for Ghost

A sign-up form inside a post where readers choose their topics, built on Ghost's own member sign-up and labels, with no extra script.

  • Works with any Ghost theme

New to Ghost snippets?

Build a card once, save it as a snippet, and add it to any post from the card menu. The tutorial shows each step.

Demo

Get the weekly letter

Stories about the world's hidden wonders, in your inbox every Friday. Pick the topics you want.

Topics

Free, one email a week. Unsubscribe any time.

Check your inbox and select the link to confirm.

Something went wrong.

Choose the topics with a mouse or the keyboard (Tab, then Space), then the email field and the button. The demo doesn't send anything.

When to use it

  • A site that covers several topics, so you can send each topic's posts only to members with that label.
  • A publication in two languages, where readers pick the one they want to receive.
  • A welcome or about page, where new readers say what they came for before your first issue.

When not to: For a plain email form, or one label for everyone, Ghost's Signup card needs no code.

The code

<div class="bt-subscribe-form-box">
  <h3 class="bt-subscribe-form-title">Get the weekly letter</h3>
  <p class="bt-subscribe-form-text">Stories about the world's hidden wonders, in your inbox every Friday. Pick the topics you want.</p>
  <form class="bt-subscribe-form" data-members-form="signup">
    <fieldset class="bt-subscribe-form-topics">
      <legend class="bt-subscribe-form-hidden">Topics</legend>
      <label class="bt-subscribe-form-topic">
        <input type="checkbox" value="Technology" data-members-label checked onchange="this.toggleAttribute('data-members-label', this.checked)">
        <span>Technology</span>
      </label>
      <label class="bt-subscribe-form-topic">
        <input type="checkbox" value="Science" data-members-label checked onchange="this.toggleAttribute('data-members-label', this.checked)">
        <span>Science</span>
      </label>
      <label class="bt-subscribe-form-topic">
        <input type="checkbox" value="Travel" onchange="this.toggleAttribute('data-members-label', this.checked)">
        <span>Travel</span>
      </label>
    </fieldset>
    <div class="bt-subscribe-form-row">
      <label class="bt-subscribe-form-field">
        <span class="bt-subscribe-form-hidden">Email address</span>
        <input type="email" data-members-email placeholder="you@example.com" autocomplete="email" required>
      </label>
      <button type="submit">Subscribe</button>
    </div>
    <p class="bt-subscribe-form-note">Free, one email a week. Unsubscribe any time.</p>
    <div aria-live="polite">
      <p class="bt-subscribe-form-success">Check your inbox and select the link to confirm.</p>
      <p class="bt-subscribe-form-error">Something went wrong. <span data-members-error></span></p>
    </div>
  </form>
</div>

Add it to your site

  1. Copy the CSS and paste it in Settings › Advanced › Code injection › Site headerSettings › Advanced › Code injection › Site header (opens your Ghost Admin in a new tab), between <style> and </style>. Once per site.
  2. In a post, add an HTML card (type /html) and paste the HTML.
  3. Change the example text to your own, then publish or update the post.

Tip

Save the card as a Ghost snippet to add it to any post from the card menu: how Ghost snippets work.

How it works

Ghost handles any form on your site with data-members-form="signup", so the form needs no script of its own. When a reader enters their email, Ghost sends them a link to confirm, and adds a class to the form while it works: loading, then success or error. The CSS uses those classes to show the right message, and Ghost puts its error text in the data-members-error span. Sign-ups have to be open in Settings › Membership › Access.

Each topic is a real checkbox, drawn as a pill, with a data-members-label attribute when it’s chosen, and its value becomes a label on the new member, so you can segment your list. Ghost applies every input that has the attribute, ticked or not, so the small onchange handler adds the attribute when a reader chooses a topic and removes it when they don’t. Travel starts unchosen, so it starts without the attribute. Change the values to your own labels, or remove the topics to keep a plain email form. For more on labels, see how to segment members with labels; to add a name field or choose newsletters, see custom subscription forms in Ghost.

For a plain form, Ghost has its own: the editor’s Signup card adds a styled form to a post and can give everyone who signs up the same label, and Settings › Growth › Signup forms makes a form to embed on other sites. Use this snippet when readers should choose their own topics.

Emails can’t send forms, so the form doesn’t work in a newsletter; use the Call to action card there.

Customize

VariableDefaultWhat it changes
--bt-subscribe-accentvar(--ghost-accent-color, #4433ff)The button and the chosen topics. Defaults to your site's accent color.
--bt-subscribe-button-text#fffThe button's text color. Use a dark color if your accent is light.
--bt-subscribe-linecolor-mix(in srgb, currentColor 14%, transparent)The box's border and the topic pills' outline, from your theme's text color, so it works on light and dark themes.
--bt-subscribe-radius12pxThe box's corner radius.
--bt-subscribe-success#15803dThe check in front of the success message.
--bt-subscribe-error#dc2626The cross in front of the error message.
Works with every Ghost theme, including ours. Something not right? Ask us.

All snippets

Launch a better Ghost site

From a solo newsletter to a busy newsroom, there is a theme that fits. No code needed.