-
Notifications
You must be signed in to change notification settings - Fork 4
Importing Content
To import blog posts from the legacy platform.coop site, we use this WP-CLI package: https://github.com/dirtsimple/postmark
Ensure that your server or development environment has the following dependencies installed:
- PHP >= 7.1
- wp-cli >= 2.3
Run:
wp package install dirtsimple/postmark
The importer supports Markdown files with YAML front matter. Front matter keys need to be uppercased for the importer, which means you need to adjust Statamic's front matter keys to match the following:
- author: trebor
+ Author: trebor
- title: Platform Coops Looking for the Next Steps
+ Title: Platform Coops Looking for the Next Steps
+ Date: August 2, 2017
Note that the date field must be added. Other fields, including featured and meta images, will be ignored, so images must be uploaded manually after the post has been imported. If there is a Twitter handle field in the file's front matter, you need to enclose it in quotes:
- twitter_creator: @trebors
+ twitter_creator: '@trebors'
The file name (minus extension) will be used for the post's URL slug.
The importer can be used in two ways.
To import a single Markdown file, run:
wp postmark sync filename.md
To import a folder of Markdown files, run:
wp postmark tree folder/
Once a post or a folder of posts has been imported for the first time, running the import command again will update the content in WordPress with any changes that have been made. This can be helpful for tweaking content that has already been imported without navigating into the WordPress dashboard. It can also overwrite things to be careful!