Photo by Cristian Labarca.
If you have a Wordpress blog hosted in Wordpress.com or installed in other web host and you are thinkig of migratting to a static site you are in luck because the brand-new Spress Import plugin can help you with that migration.
Plugin download and intallation is very easy: you just go to your Spress site folder and add the Spress import plugin as dependency by running:
composer require spress/spress-import
Migrations from Wordpress
Wordpress migrations start generating a backup all of your content in a WXR file (it's just a XML file). Generating the WXR file differs slightly between Wordpress and Wordpress.com. For the first, go to Tool → Export and then click the Download Export File button to generate and save the file in your local computer. For the second case, go to My site → Setting and then select the Export tab to download a copy of your content. More details about how to export your blog at Wordpress and Wordpress.com.
Once the WXR file is saved in your local computer, you can run
command to generate the Spress content:
$ cd /your-spress-site $ spress import:wordpress /path-to/my-wxr-file.xml --post-layout=post --fetch-images
The prior command imports all posts available in the WXR file and grabs the images
used by them. The option
post as the layout of all imported
posts. You have more options described in the documentation.
Imporing from a CSV file
To import your posts from a CSV file, run:
$ spress import:csv /path-to/post.csv --post-layout=post
The columns' structure of the CSV file is the following:
- categories (optional): a list of terms separated by semicolon. e.g: "news;events".
- tags (optional): a list of terms separated by semicolon.
- markup (optional) markup language used in content. e.g: "md", "html". "md" by default. This value will be used as filename's extension of the imported item. You have more options described in the documentation.
At this time there are only two providers but I have planned to extend the provider import family with other platforms and services such as Tumblr, Blogger or Ghost to name a few. Remember: this plugin is open source and all contributions are welcome.