Export Wordpress to Jekyll static hosting

1 minute read

Related: Create a Jekyll website from scratch


We recommend GitHub Pages with a private repo due to the easier setup and use relative to Bitbucket and GitLab.

  1. Prereq: on your laptop
    apt install php-cli php-xml git ruby-dev nodejs gcc make zlib1g-dev ruby-dev libssl-dev
       
    gem update --system
    
  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. be sure Gems are installed to home directory, NOT system (no sudo) by adding to ~/.bashrc:
    # Install Ruby Gems to ~/gems
    export GEM_HOME=$HOME/gems
    export PATH=$HOME/gems/bin:$PATH
    
  5. 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.github.io
    cd username.github.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.

  6. Create a Jekyll website with this easy procedure.

Tags:

Categories:

Updated:

Leave a comment