A newsletter archive website publishes every past issue of your email newsletter as its own web page, so new readers can browse what they would get, search engines can index your best writing, and old issues keep earning subscribers. With Astro you store issues as Markdown or MDX files in a Content Collection, generate an archive index and one page per issue, add a signup form to every page, and publish an RSS feed, all as static HTML.
Key Takeaways
- Each issue becomes a collection entry with a number, date, subject line and summary.
- The archive index groups issues by year; each issue page has previous and next links.
- Put a signup form on every issue page, because archive readers are warm leads.
- An RSS feed from
@astrojs/rssgives readers a non-email way to follow.- Import old issues once from your email provider’s export, or fetch them at build time with a loader.
Why a newsletter archive is worth building
Email providers often host a basic archive, but it usually sits on their domain, with their design and little control over SEO. An archive on your own site turns each issue into a page that can rank for its topic, be linked from social posts, and convert visitors with your own signup form. It also protects your writing if you ever change providers.
The archive has four parts:
- Issue pages at
/issues/<number>-<slug>/. - An archive index at
/issues/, grouped by year. - A signup form in the layout and at the end of every issue.
- An RSS feed at
/rss.xml.
Step 1: Set up the project and collection
npm create astro@latest letters -- --template minimal
cd letters
npx astro add mdx sitemap
npm install @astrojs/rss
Define the collection:
// src/content.config.ts
import { defineCollection } from 'astro:content';
import { glob } from 'astro/loaders';
import { z } from 'astro/zod';
const issues = defineCollection({
loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/issues' }),
schema: z.object({
number: z.number().int().positive(),
subject: z.string(),
summary: z.string().max(200),
sentAt: z.coerce.date(),
tags: z.array(z.string()).default([]),
draft: z.boolean().default(false),
}),
});
export const collections = { issues };
Write an issue:
---
# src/content/issues/042-shipping-small.md
number: 42
subject: Shipping small, every week
summary: Why a weekly release habit beat our quarterly launches, and the checklist we use.
sentAt: 2026-10-27
tags: [process, shipping]
---
Hi friends,
Three months ago we stopped planning launches...
The number field gives issues a stable order even if two go out on the same day. The draft flag lets you write the web version before sending. The Content Collections guide covers schemas in depth.
Step 2: Build issue pages
---
// src/pages/issues/[id].astro
import { getCollection, render } from 'astro:content';
import Base from '../../layouts/Base.astro';
import Signup from '../../components/Signup.astro';
export async function getStaticPaths() {
const issues = (await getCollection('issues', ({ data }) => !data.draft))
.sort((a, b) => a.data.number - b.data.number);
return issues.map((issue, i) => ({
params: { id: issue.id },
props: { issue, prev: issues[i - 1], next: issues[i + 1] },
}));
}
const { issue, prev, next } = Astro.props;
const { Content } = await render(issue);
const date = issue.data.sentAt.toLocaleDateString('en-US', { dateStyle: 'long' });
---
<Base title={`#${issue.data.number}: ${issue.data.subject}`} description={issue.data.summary}>
<article class="prose mx-auto max-w-2xl px-6 py-16">
<p class="text-sm text-zinc-500">Issue {issue.data.number} · <time datetime={issue.data.sentAt.toISOString()}>{date}</time></p>
<h1>{issue.data.subject}</h1>
<Content />
</article>
<Signup heading="Get the next issue in your inbox" />
<nav class="mx-auto flex max-w-2xl justify-between px-6 py-10" aria-label="More issues">
{prev ? <a href={`/issues/${prev.id}/`}>Previous: {prev.data.subject}</a> : <span />}
{next && <a href={`/issues/${next.id}/`}>Next: {next.data.subject}</a>}
</nav>
</Base>
Previous and next links keep readers moving through the archive, which is where most subscriptions come from. Set the page title as “#42: Subject” so the issue number appears in search results and browser tabs.
Step 3: Build the archive index
Group issues by year with a plain reduce:
---
// src/pages/issues/index.astro
import { getCollection } from 'astro:content';
import Base from '../../layouts/Base.astro';
import Signup from '../../components/Signup.astro';
const issues = (await getCollection('issues', ({ data }) => !data.draft))
.sort((a, b) => b.data.number - a.data.number);
const byYear = issues.reduce<Record<string, typeof issues>>((acc, issue) => {
const year = String(issue.data.sentAt.getFullYear());
(acc[year] ??= []).push(issue);
return acc;
}, {});
const years = Object.keys(byYear).sort().reverse();
---
<Base title="Newsletter archive" description={`All ${issues.length} past issues of the newsletter, newest first.`}>
<div class="mx-auto max-w-2xl px-6 py-16">
<h1 class="text-3xl font-bold">Archive</h1>
<p class="mt-2 text-zinc-600">{issues.length} issues and counting.</p>
<Signup compact />
{years.map((year) => (
<section class="mt-12">
<h2 class="text-xl font-semibold">{year}</h2>
<ol class="mt-4 space-y-4">
{byYear[year].map((issue) => (
<li>
<a href={`/issues/${issue.id}/`} class="font-medium">#{issue.data.number}: {issue.data.subject}</a>
<p class="text-sm text-zinc-600">{issue.data.summary}</p>
</li>
))}
</ol>
</section>
))}
</div>
</Base>
For a large archive, paginate with paginate() or add tag pages that filter by data.tags. The related posts tip shows how to suggest issues on similar topics.
Step 4: Add the signup form
Most providers (Buttondown, Kit, Mailchimp, beehiiv and others) offer an embeddable form action URL. A plain HTML form posting to it works without JavaScript.
---
// src/components/Signup.astro
interface Props { heading?: string; compact?: boolean }
const { heading = 'Subscribe to the newsletter', compact = false } = Astro.props;
const action = import.meta.env.PUBLIC_NEWSLETTER_ACTION;
---
<section class:list={['signup', { compact }]} aria-labelledby="signup-heading">
{!compact && <h2 id="signup-heading">{heading}</h2>}
<form method="post" action={action} target="_blank">
<label for="signup-email" class="sr-only">Email address</label>
<input id="signup-email" name="email" type="email" required autocomplete="email" placeholder="[email protected]" />
<button type="submit">Subscribe</button>
</form>
<p class="note">One email a week. Unsubscribe any time.</p>
</section>
Check your provider’s docs for the exact field name and action URL. The newsletter signup tip covers providers and double opt-in in more detail.
Step 5: Publish an RSS feed
Some readers prefer a feed reader to email, and feeds help other sites and tools discover new issues.
// src/pages/rss.xml.ts
import rss from '@astrojs/rss';
import { getCollection } from 'astro:content';
import type { APIContext } from 'astro';
export async function GET(context: APIContext) {
const issues = (await getCollection('issues', ({ data }) => !data.draft))
.sort((a, b) => b.data.number - a.data.number);
return rss({
title: 'Letters from the workshop',
description: 'A weekly note on building and shipping small software.',
site: context.site!,
items: issues.map((issue) => ({
title: `#${issue.data.number}: ${issue.data.subject}`,
description: issue.data.summary,
pubDate: issue.data.sentAt,
link: `/issues/${issue.id}/`,
})),
});
}
Set site in astro.config.mjs and add <link rel="alternate" type="application/rss+xml" href="/rss.xml" /> to the layout’s <head>. The RSS docs cover full-content feeds.
Step 6: Import your past issues
You probably have years of issues in your email provider already. Two ways to bring them in:
- One-time export. Most providers export issues as HTML, Markdown or CSV. Convert each to a Markdown file with the frontmatter above. A short Node script can map an export to files, then you review them in git.
- Build-time loader. If your provider has an API that lists sent emails, write an inline Content Collection loader that fetches them during the build, so new issues appear on the site after each rebuild without copying files.
// src/content.config.ts (loader version)
const issues = defineCollection({
loader: async () => {
const res = await fetch('https://api.provider.example/v1/emails?status=sent', {
headers: { Authorization: `Token ${import.meta.env.NEWSLETTER_API_KEY}` },
});
const { results } = await res.json();
return results.map((email: any, i: number) => ({
id: String(email.slug ?? email.id),
number: results.length - i,
subject: email.subject,
summary: email.description ?? '',
sentAt: email.publish_date,
html: email.body,
}));
},
schema: z.object({
number: z.number(),
subject: z.string(),
summary: z.string(),
sentAt: z.coerce.date(),
html: z.string(),
}),
});
When the body comes back as HTML, render it with <Fragment set:html={issue.data.html} /> on the issue page. Email HTML is often full of inline styles and table layouts, so strip or sanitize it before rendering, and remove tracking pixels and personalised unsubscribe links. The field names above are placeholders; match them to your provider’s API.
Step 7: Search and SEO
- Add Pagefind after the build (
pagefind --site dist) and a search box on the archive page so readers can find old issues by topic. - Give each issue a specific subject line as its
<h1>and title. “Issue 42” alone tells search engines nothing. - Remove time-sensitive content (event dates, discount codes) from the web version, or mark it clearly.
- Generate a sitemap with
@astrojs/sitemap.
Deploy
Run npm run build and deploy dist/ to any static host. Connect the repo to Cloudflare Pages, Netlify or Vercel so committing a new issue file publishes it. If you use the loader approach, add a deploy hook and call it from your provider’s “email sent” webhook, or schedule a daily rebuild. The deploy guide covers each host, and the official @astrojs/rss docs list every feed option.
Starting from a template
Any blog-style Astro theme works as a newsletter archive, because the structure (list of dated posts, a reading layout and a signup form) is the same. Free options include AstroPaper and Astro’s official blog starter. Komal Nakrani’s blog and editorial category holds editorial designs you can adapt by renaming the blog collection to issues.
FAQ
What is a newsletter archive?
A newsletter archive is a public collection of past newsletter issues published as web pages. It lets potential subscribers read before signing up, makes your writing searchable and indexable, and keeps old issues useful after they have left the inbox.
Should I publish my newsletter issues on my website?
Usually yes. Publishing issues on your own domain helps them rank in search, gives every issue a shareable URL and gives you a place to put signup forms. Keep subscriber-only content off the archive, or publish it after a delay, if exclusivity is part of the offer.
How do I move my newsletter archive from Substack or another provider?
Export your posts from the provider, convert each one to a Markdown file with frontmatter such as number, subject, date and summary, and add them to an Astro Content Collection. Set up redirects from the old archive URLs if the provider lets you, so existing links keep working.
Can my newsletter archive update automatically when I send an issue?
Yes, if your provider has an API. Load issues at build time with a Content Collection loader, then trigger a rebuild from the provider’s webhook or a scheduled job. Without an API, add each issue as a Markdown file and commit it; the host rebuilds on push.
Do I need RSS for a newsletter archive?
It is optional but cheap to add. With @astrojs/rss, a feed takes one endpoint file. Some readers prefer feed readers to email, and feeds help aggregators and tools discover new issues.