Skip to main content

A Python CLI application that converts a WordPress WXR backup file to MD files usable by Hugo.

Project description

wp2hugo

This Python module helps you convert a WordPress WXR file to MD files.

The MD files can then be used to start up a Hugo site, making this module an important first step if you want to convert your WordPress site to Hugo.

Description

The module has two run modes: create and stats.

Run mode create will open your WXR XML file and create the required MD files.

Run mode stats will dump some quick statistics about the WXR XML file, including number of posts, number of pages, number of tags and number of categories.

Installation

Install the module using pip.

pip3 install wp2hugo

Usage

Create

To create the MD files, use create.

wp2hugo create <xmlfile> --outdir <directory> --lowercasetags

Parameters:

  • <xmlfile>
    • Path to the WXR XML file
    • Required: yes
  • --outdir <directory>
    • Path to the output directory, will be created if not existing
    • Default: ./out
    • Required: no
  • --lowercasetags
    • Whether or not to convert tags from WXR files to lowercase
    • Default: false
    • Required: no

stats

To display statistics about the WXR file, use stats.

wp2hugo stats <xmlfile>

Parameters:

  • <xmlfile>
    • Path to the WXR XML file
    • Required: yes

Create export file

The WXR export can be created using one of two methods:

  • export from the WordPress web dashboard
  • export made from using the WP CLI tool

Wordpress web dashboard

Follow these steps to create the export.

  • Log in to your WordPress site
  • Go to Tools -> Export
  • Ensure that All content is selected
  • Click the Download Export File button

Export image

Your web browswer will now download the generated export file.

WP CLI tool

Setting up and using the WP CLI tool is outside the scope of this README, but please consult the documentation.

It is fairly straightforward, and requires either console access to where the WordPress files are located, or access via SSH.

Credits

This Python module is heavily based on the wxr2md module by Dion Susanto. A huge thanks go out to him for his work.

License

MIT

Author

This module was created by Jostein Elvaker Haande.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wp2hugo-0.1.2.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wp2hugo-0.1.2-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file wp2hugo-0.1.2.tar.gz.

File metadata

  • Download URL: wp2hugo-0.1.2.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for wp2hugo-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2f2f37b62c67bb93d4b8d7c584cde11ae3ade40e65351d4255f203b3a3fb5241
MD5 089de80d1463c10670878f71fb0ccb7e
BLAKE2b-256 75fe63a5c1d6930b5863c2e4da1dc992401e4a5c84342076036684504758e22c

See more details on using hashes here.

File details

Details for the file wp2hugo-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: wp2hugo-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for wp2hugo-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d21c8fff72bdf1590f00873953ca32766a1da037a17c485c161103e0d881b6a4
MD5 bdd88ca6b2110a551e2221fd84a34e2b
BLAKE2b-256 287130dda5de9a7b8348bf6e2fec3dc777b2fee9740697877a82d2fd0e92a9dd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page