Migrate your blog from WordPress to Hexo.
In your blog folder, add this npm dependency to your project:
$ npm install hexo-migrator-wordpress --save
Export your WordPress in "Tools" → "Export" → "All Content" in your dashboard.
Execute the following command after installed. source
is the file path or URL of WordPress export file.
$ hexo migrate wordpress <source> [--options]
alias
setting in the front-matter, for use with the hexo-generator-alias module. This is useful for generating redirects.$ hexo migrate wordpress /path/export.xml --limit 3
http://yourwordpress.com/wp-content/uploads/2020/07/image.jpg
=> source/2020/07/image.jpg
=> http://yourhexo.com/2020/07/image.jpg
.![title](http://yourwordpress.com/wp-content/uploads/2020/07/image.jpg)
=> ![title](/2020/07/image.jpg)
post_asset_folder
is enabled before migration, images will be saved according to their associated post.
http://yourwordpress.com/wp-content/uploads/2020/07/image.jpg
is associated with http://yourwordpress.com/2020/07/04/foo-post/
post.http://yourwordpress.com/wp-content/uploads/2020/07/image.jpg
=> source/_posts/foo-post/image.jpg
=> http://yourhexo.com/2020/07/04/foo-post/image.jpg
.![title](http://yourwordpress.com/wp-content/uploads/2020/07/image.jpg)
=> ![title](image.jpg)
postAsset:
option.http://yourwordpress.com/wp-content/uploads/2020/07/image-500x300.jpg
=> source/2020/07/image-500x300.jpg
=> http://yourhexo.com/2020/07/image-500x300.jpg
.post_asset_folder
: http://yourwordpress.com/wp-content/uploads/2020/07/image-500x300.jpg
=> source/_posts/foo-post/image-500x300.jpg
=> http://yourhexo.com/2020/07/04/foo-post/image-500x300.jpg
.$ hexo migrate wordpress /path/export.xml --import_image
http://yourwordpress.com/wp-content/uploads/2020/07/image-500x300.jpg
=> source/2020/07/image.jpg
=> http://yourhexo.com/2020/07/image.jpg
.$ hexo migrate wordpress /path/export.xml --import_image original
$ hexo migrate wordpress /path/export.xml --default-category 'unknown'
# _config.yml
default_category: uncategorized