A small custom utility for parsing my Wordpress XML export and getting into the data model I want for Contentful.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
Gopkg.lock
Gopkg.toml
LICENSE
README.md
create_attachments.go
create_authors.go
create_categories.go
create_posts.go
create_tags.go
deletions.go
main.go
parse_wordpress.go
redirects.go

README.md

Summary

This is just a set of tooling to help me migrate my WordPress blog to Contentful. Probably not very useful for the general case, but I'm documenting how it is used in case I forget.

Prerequisites

You need to have the following installed:

  • dep for go dependency management
  • pandoc (e.g. from homebrew) for HTML to Markdown conversion

Building/Running

dep ensure
go build
./wp_to_contentful -filename <WordpressDump.xml> -space <SpaceID> -token <CMAToken>

The following are created:

  • tags
  • authors
  • categories
  • assets (both images and other attachments)
  • blog posts

Each of the above with exception of assets get their own content type. Posts make use of links to link to the entries for tags/categories/authors rather than duplicating the data directly in the post. The data in these other content types is minimal, but it's better to do it this way for content searching.

Additionally, a Netlify-compatible _redirects file is generated from the renamed paths of posts and assets.