Importing posts to Spress from Wordpress and CSV files is now possible thanks to Spress Import plugin

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 spress import:wordpress 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-layout sets 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:

  1. title
  2. permalink
  3. content
  4. published_at
  5. categories (optional): a list of terms separated by semicolon. e.g: "news;events".
  6. tags (optional): a list of terms separated by semicolon.
  7. 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.

Posted by Victor Puertas on

Comments

comments powered by Disqus