The Buttondown CLI makes it easy to manage your newsletter emails as Markdown files with YAML frontmatter, enabling a local-first workflow with your favorite tools.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/buttondown/cli/llms.txt
Use this file to discover all available pages before exploring further.
Creating New Emails
Use thecreate command to generate a new draft email:
emails/my-first-newsletter.md:
emails/my-first-newsletter.md
The slug is automatically generated from the title by converting to lowercase and replacing non-alphanumeric characters with hyphens.
How Create Works
Fromsrc/commands/create.tsx:23:
- Creates the
emails/directory if it doesn’t exist - Generates a URL-safe slug from the title
- Checks if a file with that slug already exists
- Creates a new Markdown file with default frontmatter
Email File Structure
Emails are stored as Markdown files with YAML frontmatter:Frontmatter Fields
Core Fields
The email subject line that subscribers will see in their inbox.
Email status:
draft, scheduled, or sent.Audience type:
public, private, or premium.URL-friendly identifier used in web archive links.
Optional Fields
Buttondown’s unique identifier. Automatically added after first push. Don’t modify this manually.
ISO 8601 timestamp for when to send/publish the email.
Preview text shown in email clients and web archives.
Open Graph image URL for social media sharing.
Original URL if this email is republished content.
Whether to feature this email prominently in your web archive.
Comment settings:
enabled, disabled, or paid_only.Custom key-value pairs for organizing and filtering emails.
Subscriber targeting rules. See Subscriber Filters below.
List of related email IDs to show in the web archive.
URLs of files to attach to the email.
Subscriber Filters
Target specific subscribers using filter rules:Filter Fields
tags- Subscriber tagsemail- Email addressmetadata- Subscriber metadatasubscription_date- When they subscribedreferrer_url- How they found you
Filter Operators
contains/does_not_containequals/does_not_equalstarts_with/ends_withgreater_than/less_than
Working with Email Content
Using Markdown
Write your email body using standard Markdown:Adding Images
Reference images from yourmedia/ directory using relative paths:
Using Variables
Buttondown supports template variables:{{ subscriber.name }}- Subscriber’s name{{ subscriber.email }}- Subscriber’s email{{ unsubscribe_url }}- Unsubscribe link{{ view_online_url }}- Web archive link{{ manage_subscription_url }}- Preferences page
Including Snippets
Reference reusable snippets:Editing Existing Emails
Pull emails from Buttondown to edit them locally:Organizing Emails
You can organize emails in subdirectories:.md files recursively in the emails/ directory.
Email Lifecycle
Draft → Scheduled → Sent
Validation
The CLI validates email files when reading them. Fromsrc/sync/emails.ts:76:
- Missing frontmatter delimiters (
---) - Invalid YAML syntax
- Missing required fields
Best Practices
Use descriptive slugs
Use descriptive slugs
Choose clear, descriptive slugs that make sense in your web archive URL:
Keep images in media/
Keep images in media/
Always store images in the
media/ directory and use relative paths:Preview before pushing
Preview before pushing
Use a Markdown previewer to check formatting before pushing to Buttondown.
Add metadata for organization
Add metadata for organization
Use the
metadata field to organize and filter emails:Next Steps
Push Content
Push your emails to Buttondown
Manage Media
Work with images and attachments