Importing into Kirby from Perch CMS

I’m moving a site from Perch CMS into Kirby. Most of the pages will be copied over but I was hoping to import about 70 blog posts. What approach would you take here?

I can get Perch to write the data in various formats.

I’ve seen a couple of older posts about importing and how it’s possible to use a spreadsheet to generate the content in Kirby. Is that the best approach?

Yes, you can read all kinds of files and iterate over the data to create pages.
Say you export a CSV and turned the content into an array:

// simplified example
foreach($csv as $csvPage) {
  page('blog')->createChild([
    'slug' => Str::slug($csvPage['title']),
    'template' => 'post',
    'content'  => [
      'title' => $csvPage['title'],
      // all the fields...
    ]
  ])->changeStatus("listed", 0);
}

I tend to create an import route for this as it’s the easiest and fastest way.

2 Likes

Many thanks!

I’ve also found this Data Importer plugin which looks useful.