Export Wordpress to Jekyll static hosting

The examples show Gitlab but of course work equally well with Github/Bitbucket/etc. I use Gitlab instead of Github Pages becuase of Gitlab’s unlimited free repos.

  1. Prereq: on your laptop

    Linux

      apt install php-cli php-xml git ruby-dev nodejs gcc make zlib1g-dev
    

    Note that we don’t install ruby-bundler because in general it’s out of date–we’ll install it later.

    Mac

     brew install git
     brew install node
     # rest is for php-cli
     brew tap homebrew/dupes
     brew tap homebrew/versions
     brew tap homebrew/homebrew-php
     brew install php70
    
  2. Export Wordpress site to XML. This method doesn’t capture tags or comments. It requires manual upload of images. But doesn’t use server Wordpress plugins that are broken for current Wordpress versions.
  3. Log into your Wordpress dashboard then click: Tools > Export > All
  4. execute Wordpress to Jekyll exporter on your laptop

     gem install bundler
    
     gem install github-pages
    
     cd ~
     git clone https://gist.github.com/522402.git
     mkdir username.gitlab.io
     cd username.gitlab.io
    
     php ../gist-522402/WordpressExporter.php ../wordpress.xml
    

    You’ll notice lots of .html files in a _posts directory. Note that Drafts and Privates will be in there too!

    You’ll need to tweak image references, and you lose tags, but it’s better than converting years of Wordpress posts by hand.

    Images/videos/media

    There is not a native way to export your Wordpress Media Library (another good reason to ditch Wordpress). I suggest grabbing your images and video using FTP to your Wordpress server. Look at your server provider’s documentation for how to do this.

  5. Create a Jekyll website with this easy procedure.

Tags:

Categories:

Updated:

Leave a Comment