TheDocumentation 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.
push command uploads your local content changes to Buttondown, intelligently detecting what has changed and only updating what’s necessary.
How Push Works
When you runbuttondown push, the CLI performs an intelligent sync:
Read Sync State
Loads the
.buttondown-sync.json file to understand which images have already been uploaded and their URL mappings.Process Local Emails
Reads all email files from the
emails/ directory and identifies any relative image references that need to be uploaded.Upload New Images
Automatically uploads any images referenced in emails that haven’t been synced yet to Buttondown’s media library.
Convert Image References
Replaces relative image paths with absolute URLs from Buttondown before uploading email content.
Detect Changes
Compares local emails with remote versions to identify only the emails that have actually changed.
Basic Usage
Push all local changes to Buttondown:What Gets Pushed
Changed Emails Only
The push command is smart about detecting changes. It only uploads emails that have been modified since the last sync:push frequently without worrying about unnecessary API calls or updates.
Automatic Image Upload
When you add new images to your emails using relative paths, push automatically handles the upload:- Finds the relative image reference
../media/new-product.png - Uploads
new-product.pngto Buttondown - Receives the remote URL (e.g.,
https://buttondown.s3.amazonaws.com/images/xyz789.png) - Replaces the relative path with the remote URL in the email content
- Pushes the updated email
Automations
Modified automation files inautomations/ are pushed to Buttondown:
- Existing automations (with an
idfield) are updated via PATCH - New automations (without an
id) are created via POST
automations/onboarding.json
Snippets
Snippets insnippets/ are synced based on their identifier:
snippets/social-links.md
Newsletter Settings
Changes tonewsletter.json update your newsletter configuration:
newsletter.json
Image Handling Details
Supported Image Formats
The push command supports uploading these image types:- PNG (
.png) - JPEG (
.jpg,.jpeg) - GIF (
.gif) - WebP (
.webp) - SVG (
.svg)
Images are uploaded with the correct MIME type based on their file extension.
Image Upload Process
From the source code atsrc/sync/images.ts:24:
Relative to Absolute Conversion
The CLI finds all relative image references and converts them:src/commands/push.tsx:138:
Push Results
After pushing, you’ll see detailed results:Best Practices
Pull before pushing
Pull before pushing
Always run
buttondown pull before making changes and pushing. This ensures you have the latest content and prevents conflicts.Test emails locally first
Test emails locally first
Preview your Markdown content locally before pushing to ensure formatting is correct.
Use version control
Use version control
Commit your changes to Git before pushing to Buttondown. This creates a history of your newsletter content.
Check image paths
Check image paths
Make sure relative image paths are correct before pushing. The image file must exist in your
media/ directory.Troubleshooting
”Image upload failed”
Make sure:- The image file exists at the specified path
- The file is a supported image format
- You have permission to read the file
”Email already exists”
If you’re creating a new email without anid field but an email with that slug already exists on Buttondown, you’ll get an error. Pull first to get existing email IDs.
”Sync state not found”
Runbuttondown pull first to initialize the sync state file:
Next Steps
Pull Content
Learn how to pull content from Buttondown
Manage Emails
Create and edit newsletter emails