eph baum dot dev

← Back to blog

Ghost Blog backup to Astro markdown

Published on 10/09/2023 09:59 PM by Eph Baum

Featured Image

The Problem:

I believe I have mentioned here in the past my desire to leave the Ghost Blog platform in favor of using Astro for at least some of my blogs.

To be clear, I love the Ghost platform, but I’ve long been interested in moving to a more simplistic static hosting solution. I find that Ghost is a bit more than I really need and, at least for most of my use cases, more overhead than I’d prefer. I’ve looked at using multiple options such as Gatsby. Not too long ago I had Astro recommended and I’ve been playing with it ever since and found it very much to my liking.

The issue that I encountered was that I have not been able to find a useful tool or tutorial that would allow me to easily migrate my posts from Ghost to Astro.

Ghost has long had a backup feature. More recent versions of Ghost include a backup tool in the CLI. The backups that produces a zip archive containing your content and various metadata related to your Ghost Blog

I found one useless tutorial that pointed to a tool that claimed to convert Ghost Blog’s backup to markdown files but the issues and commit history suggested it is quite outdated. The last commit was in 2019. The tutorial itself is incomplete even if the tool it referenced worked.

The Solution:

Write it myself was the path I chose.

Here’s an embedded a gist with some placeholders that accomplishes my goal, broadly:

(If you don’t see the embed here, you can try refreshing the page. I’m not sure why Astro doesn’t like to render script tages on the first pass, nor am I sure yet why this theme doesn’t render MDX files)

This solution isn’t perfect. There are myriad improvements and optimizations possible, but it served my needs pretty well recently and I felt it was worth sharing for anyone else looking to accomplish this same goal.

I think it’s pretty self explanatory. It uses Turndown to convert the HTML in the JSON backup file to Markdown and then outputs each post as its own Markdown file.

Good luck and feel free to reach out if you have any questions.


Update (October 2025): This script was successfully used to complete the full migration from Ghost CMS to Astro! You can read about the complete 2-year migration journey in my follow-up post: “Migrating from Ghost CMS to Astro: A Complete Journey”.

Written by Eph Baum

  • AI

    AI

    This may read as alarmist. It might not be alarmist enough. On AI as sophisticated autocomplete, not thinking—and why that gap matters to the future.

  • Slow Down

    Slow Down

    Speed worship is anxiety wearing a productivity costume. The case for slowing down—and why going fast is often how you screw everything up.

  • Making Brutalist Design Accessible: A Journey in WCAG AA Compliance

    Making Brutalist Design Accessible: A Journey in WCAG AA Compliance

    How I transformed my brutalist blog theme to meet WCAG AA accessibility standards while preserving its vibrant, random aesthetic. Talking about contrast ratios, color theory, and inclusive design.

  • Building Horror Movie Season: A Journey in AI-Augmented Development

    Building Horror Movie Season: A Journey in AI-Augmented Development

    How I built a production web app primarily through 'vibe coding' with Claude, and what it taught me about the future of software development. A deep dive into AI-augmented development, the Horror Movie Season app, and reflections on the evolving role of engineers in the age of LLMs.

  • Chaos Engineering: Building Resiliency in Ourselves and Our Systems

    Chaos Engineering: Building Resiliency in Ourselves and Our Systems

    Chaos Engineering isn't just about breaking systems — it's about building resilient teams, processes, and cultures. Learn how deliberate practice strengthens both technical and human architecture, and discover "Eph's Law": If a single engineer can bring down production, the failure isn't theirs — it's the process.

  • Using LLMs to Audit and Clean Up Your Codebase: A Real-World Example

    Using LLMs to Audit and Clean Up Your Codebase: A Real-World Example

    How I used an LLM to systematically audit and remove 228 unused image files from my legacy dev blog repository, saving hours of manual work and demonstrating the practical value of AI-assisted development.