Convert WordPress and Squarespace exports to the Hugo static site generator
This is an updated version of the ExitWP tool, originally created by Thomas Frössman for Jekyll and later adapted for Hugo by Arjan Wooning.
For a detailed guide and background information, visit Arjan Wooning's website.
ExitWP is a tool designed to simplify the migration process from one or more WordPress blogs, or other blogs/websites exported to the WordPress XML format, to the Hugo static site generator. It aims to convert as much information as possible from the WordPress export, with options to filter the converted data. SquareSpace also offers the option to export your site as WordPress formatted XML file(s).
- Converts WordPress export XML to Hugo-compatible Markdown or HTML
- Downloads and processes images within posts
- Supports inclusion of comments from WordPress posts
- Handles tags and categories for Hugo
- Flexible configuration options via
config.yaml
Please refer to the Release notes (RELEASE_NOTES.md) for an overview of changes and updates.
- Clone the repository:
git clone https://github.com/wooni005/exitwp-for-hugo.git
- Export your WordPress blog(s) using the WordPress exporter (Tools > Export in WordPress admin). Other website hosting sites, like SquareSpace also offer the option to export your site as WordPress formatted XML file(s).
- Place all WordPress XML files in the
wordpress-xml
directory - Configure the tool by editing
config.yaml
- Run the converter:
python3 exitwp.py
- Optionally, if the script runs into issues, or the output does not appear to be correct, run
xmllint
part of Libxml2 on your export file(s) and fix any errors. - Your converted blog(s) will be in separate directories under the
build
directory, specified inconfig.yaml
.
- Python 3.x
- markdownify
- PyYAML
- Beautiful Soup 4
pip3 install -r requirements.txt
Refer to the config.yaml
file for all configurable options. Key settings include:
wp_exports
: Directory containing WordPress export XML filesbuild_dir
: Target directory for outputdownload_images
: Whether to download and relocate imagesinclude_comments
: Option to include comments in the exported contenttarget_format
: Choose between 'markdown' or 'html' outputimage_settings
: Configure image processing behavior
Basic usage:
python3 exitwp.py
For verbose output:
python3 exitwp.py -v
- Potential issues with non-UTF-8 encoded WordPress dump files
- Image downloading may fail for some URLs due to various reasons (404 errors, timeouts, etc.)
This tool is not actively maintained. For support or custom modifications, consider using AI chatbots like ChatGPT or Claude.
If you've made significant improvements to the tool, feel free to submit a pull request.