Skip to content

Newsletter

The Newsletter section follows the same pattern as the Contact form: set a provider, paste the action URL from your ESP’s embed code, save. The form emits whatever input names your provider expects.

src/config/site.ts
newsletter: {
provider: null as "mailchimp" | "convertkit" | "buttondown" | null,
heading: "Stay in the loop",
subtext: "Get product updates, tips, and insights delivered to your inbox.",
placeholder: "Enter your email",
buttonLabel: "Subscribe",
// actionUrl: "https://your-provider.com/subscribe",
}

If provider is null (the default) or actionUrl is missing, the form renders disabled with a friendly “configure your provider” hint, so buyers see the slot.

  1. In Mailchimp, go to Audience → Signup forms → Embedded forms.

  2. Look at the generated HTML. Find the <form action="…" method="post"> tag — that whole URL is your actionUrl. It looks like:

    https://yourdomain.us21.list-manage.com/subscribe/post?u=abc123&id=def456
  3. Set:

newsletter: {
provider: "mailchimp",
actionUrl: "https://yourdomain.us21.list-manage.com/subscribe/post?u=abc123&id=def456",
// … heading / subtext / etc.
}

The form posts the subscriber email with name="EMAIL" — Mailchimp’s standard.

  1. In Kit, go to Grow → Landing Pages & Forms → your form → Embed.

  2. Pick the HTML tab. Copy the action URL — it looks like:

    https://app.convertkit.com/forms/1234567/subscriptions
  3. Set:

newsletter: {
provider: "convertkit",
actionUrl: "https://app.convertkit.com/forms/1234567/subscriptions",
}

The form posts the subscriber email with name="email_address" — Kit’s standard.

  1. In Buttondown, go to Settings → Embedding.

  2. Your username is the actionUrl’s last segment:

    https://buttondown.email/api/emails/embed-subscribe/yourusername
  3. Set:

newsletter: {
provider: "buttondown",
actionUrl: "https://buttondown.email/api/emails/embed-subscribe/yourusername",
}

The form posts the subscriber email with name="email" — Buttondown’s standard.

newsletter: { provider: null }

The form renders with disabled inputs and a small hint pointing to siteConfig.newsletter.provider. Useful pre-launch so you can preview the section without wiring an ESP.

Open src/components/Newsletter.astro. The frontmatter resolves provider into the correct email-input name (each ESP expects a different one):

src/components/Newsletter.astro (excerpt)
const emailInputName =
n.provider === "mailchimp" ? "EMAIL" :
n.provider === "convertkit" ? "email_address" :
n.provider === "buttondown" ? "email" :
"email";

The form opens in a new tab (target="_blank") so visitors stay on your site after subscribing — they see the provider’s success page in a popup, then close it.

The four text fields above the form are all in siteConfig.newsletter:

heading: "Stay in the loop",
subtext: "Get product updates, tips, and insights delivered to your inbox.",
placeholder: "Enter your email",
buttonLabel: "Subscribe",

Change them once; every theme reads the same fields.

Add a new branch to the provider switch in Newsletter.astro:

const emailInputName =
// …existing branches…
n.provider === "mailerlite" ? "fields[email]" :
"email";

…and update the union type in site.ts. The actionUrl will whatever your ESP’s embed action URL is.