I’m researching the possibility of moving a website to Kirby. I don’t see any official/unofficial importer plugins in my searching, but I could have missed something obvious. I’m coming from a static site generator, so I have a pile of markdown files to work with. The site is about 600-plus total pages/posts. I’m not hoping for perfection, but maybe a head start. How have folks handled this in the past?
Basically, the procedure is always the same, no matter from what source you start:
Read the original content/front matter
Convert this import data into Kirby pages, using Page::create() (Page::create() | Kirby CMS). This takes care of creating the page folder with the content text file inside.
So the basic procedure is fairly easy. I’m not familiar with static site generators, but I guess information about the page structure is somewhere in the front-matter? So that would then help to determine the site structure.
But then in a site there are usually files as well. So you would have to copy them into the page folders as well.
While there are WordPress importers out there, I haven’t seen an importer for static site generators, although I’m pretty sure there are people who’ve done it.
I would write a quick python script to rename / modify the files to the desired folder structure / file name / file content structure that you would need with Kirby.
This will depend widely on what your pages contain, and how you plan on editing the content with Kirby.
If all your files are a single Title and full markdown content, you could go with a single kirby blueprint and template with title and a markdwon field. This would be the quickest way.
If however you have a lot of page specific fields/settings you need to reproduce, it would require a bit more tweeking.
That’s why I suggested to use Kirby’s Page::create() method, in which you just pass an array with your data, then Kirby takes care of the rest, including the separation dashes…