How to Add a Newsletter to Your Astro Blog

This guide explains how to integrate BlogTally Broadcast with your Astro-powered blog to automatically send newsletters based on your RSS feed.

Prerequisites

  • An Astro blog
  • A BlogTally account
  • Basic knowledge of npm and JavaScript

Setting up RSS Feed in Astro

Before integrating with BlogTally Broadcast, you need to set up an RSS feed for your blog. Here's how to do it:

1. Install RSS Package

npm install @astro/rss

2. Create RSS Feed

Create a new file at src/pages/rss.xml.js with the following content:

import rss from '@astro/rss';

export const GET(context) {
  const blog = await getCollection('blog');
  return rss({
    title: 'Your Site Title',
    description: 'Your site description',
    site: context.site,
    items: await pagesGlobToRssItems(
      import.meta.glob('./blog/*.{md,mdx}'),
    ),
  });
};

For additional RSS feed customization options, refer to the Astro RSS documentation.

Integrating with BlogTally Broadcast

Once your RSS feed is set up, you can integrate it with BlogTally Broadcast in two steps:

1. Create a Campaign

  1. Navigate to the Campaigns section in your BlogTally dashboard
  2. Create a new RSS-based campaign
  3. Enter your Astro blog's RSS feed URL
  4. Configure your campaign settings

For detailed instructions on campaign creation and management, see our Campaign Management Guide.

2. Add a Subscription Form

To collect subscribers, you'll need to add a subscription form to your blog. BlogTally provides several options:

  • Use our pre-built forms
  • Create a custom form
  • Integrate with your existing forms

For form creation and customization instructions, check our Forms Documentation.

Next Steps

Need Help?

If you encounter any issues or need assistance, feel free to contact our support team