Austen's Blog

moon indicating dark mode
sun indicating light mode

Migrating from to Gatsby, CircleCI and AWS Hosting

October 12, 2019

It’s my renewal time and whilst the service has been fine the whole paradigm and technical approach is a little dated. There’s also some great free or very cheap services for personal site hosting out there and my preference is to have everything under source control and to follow CI/CD principles. There’s also a whole raft of static site generators which have matured significantly over the last few years which enable the above - so now seems like as good a time as any to migrate away.


  • Everything must be under source control
  • Follow CI/CD principles and tooling
  • Minimise cost where possible
  • Updates must be possible remotely via iOS
  • The migration should be seamless. That is:
    • Current URL’s should still work
    • Photo’s and images currently hosted on WordPress must migrate
    • Posts with embedded Google Maps must still operate
    • Google Analytics should be used to monitor usage
    • Existing comments must migrate
    • The migration must not require lots of manual change. i.e. it’s scripted

TIP: to save looking through each of your posts. Complete steps 1 and 2 below and then run the following on the Markdown output:

grep -l '\[gallery' *

Export all posts and images from

  • Login to the admin console
  • Navigate to Tools > Export

Use ExitWP to convert Wordpress XML to Markdown


Move and rename Markdown files

From the output directory of ExitWP use the following script to move posts to a directory structure which preserves WordPress’ url scheme.

for file in *.markdown
if [[ $file =~ $regex ]]
echo "${year}/${month}/${day}/${name}.md"
echo "$file doesn't match" >&2
if [ -d "${dir}" ]
echo "directory ${dir} exists"
mkdir -p $dir
mv $file $dir/$

Resize images

find . -iname '*.jpg' -exec convert {} -verbose -resize 1000000@ {} \;

Place the images in the root static folder

mv images/* static/images/

Switch your posts to use the local images rather than WordPress hosted

find . -type f -exec sed -i '' 's=' {} \;

Manually update any captions

# figure out the list of posts with captions
grep -rl '\[caption' *

Switch Google Maps tags to iframes

find . -type f -exec sed -i '' 's/\[googlemaps /<iframe src="/g' {} \;
find . -type f -exec sed -i '' 's/w=640&h=480\]/w=640&h=480" width="640" height="480"><\/iframe>/g' {} \;
find . -type f -exec sed -i '' 's/w=425&h=350\]/w=425&h=350" width="425" height="350"><\/iframe>/g' {} \;
find . -type f -exec sed -i '' 's/h=350\]h=350/h=350/g' {} \;

Wait for part 2 for deployment and remote updates via iOS.