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.

Written by Eph Baum

← Back to blog
  • 50 Stars - Puzzle Solver (of Little Renown)

    50 Stars - Puzzle Solver (of Little Renown)

    Join Eph Baum as they recount their journey through the Advent of Code 2023. For the first time, Eph completes all puzzles, leveraging resources like GPT-4 and Code Llama. Despite the challenges and time constraints, Eph not only stays on top of the puzzles but also lands on the top 1,000 leaderboard. Dive into this post to explore the role of generative AIs in problem-solving and the joy of coding puzzles. - GitHub Co-pilot

  • Don't Trust AI - An Advent of Code Tale

    Don't Trust AI - An Advent of Code Tale

    Join Eph Baum in 'Don't Trust AI - An Advent of Code Tale' as they navigate the Advent of Code 2023. Despite the December rush, Eph is determined to complete all puzzles. This post shares an intriguing incident where an AI-generated code line proves less than helpful. Eph's journey underscores the importance of verifying AI suggestions, especially when optimizing code. Dive in to explore the challenges and triumphs of coding puzzles, and the role of AI in this process. - GitHub CoPilot

  • Condoning Another Pi Day

    Condoning Another Pi Day

    Placeholder description for imported post from Ghost Blog

  • ANSI Terminal Colors

    ANSI Terminal Colors

    Placeholder description for imported post from Ghost Blog

  • WTF is Idiomatic

    WTF is Idiomatic

    Placeholder description for imported post from Ghost Blog

  • From Early Return in OOP to Control Flow in Elixir - A Transition Guide

    From Early Return in OOP to Control Flow in Elixir - A Transition Guide

    Placeholder description for imported post from Ghost Blog