Congratulations on your decision of migrating from Wordpress to Hugo!
Oh, you haven't? Here are some reasons.
You may have already noticed the export from Wordpress is quite ugly and hard to parse.
Luckily, this fantastic community provides tome tools for this task.
The post export worked out quite well using this tool, but I struggled with the comments.
That's why I wrote my own tool for this.
The output are yaml
files that can be e. g. used by Staticman.
So basically this tool takes a wordpress export and converts it to this:
(in output/my-post-id/comment-1628575290.yml
)
_id: '1'
comment: 'Wow, I used to me a Wordpress comment. I\'m finally free!'
date: '2022-04-04 08:01:30'
email: christian@commenter.com
email_hash: 9b77b628098cfa13f8e96da3d03ff548
name: Christian Commenter
You only need Docker for this.
- Put the Wordpress export XML files into a directory called
input
in the project directory - Copy the
.env.example
file to.env
:cp .env.example .env
- Insert the URL of the Wordpress site you want to export the comments from in your
.env
file. This is necessary to extract the id from the post, which is used as the directory for the comment - Run
docker-compose up
- Find the
yaml
files in theoutput
directory within their respective directories