Forum
Converting a large website to Perch Runway
Hi, My colleague and I are thinking to convert a website from another CMS to Perch Runway, and I'm wondering if I could ask for some tips.
We'd manually create some Perch master pages (with improved markup) to match the various kinds of pages on the old site.
Because we have no export facility on the old CMS, we used wget to download the old site.
The main content part of the master pages would be single a Perch region, edited with ckEditor. We want to create pages, and populate the content for these regions, using a NodeJS script. (Use what you know :)
It would recursively loop through the site's directories and in each directory, if it has an index.html, use JSDOM + jQuery to process its main content div: clean up the markup a little, and then extract its innerHTML to make a string of markup.
For each index.html, use this markup string, plus the file's path in the site directory tree and the pages title attribute to make a SQL insert statement, adding it to an SQL script file. Then we'd run the SQL produced script file against the Perch database.
Could you provide tips on the SQL insert statements we would need?
Or, might there be a better overall method? We're hoping to avoid something like Selenium/Webdriver.
(Obviously we'd need to deal with assets too -haven't braved thinking of that yet :) )
I think you'll need to be careful. From what I remember, Perch actually stores three versions of each item in the database. It might be better to get the script to post the content through the admin rather than trying to inject it directly into the DB.
This is another "wait for Perch 3" answer - but, I believe there will be an api to allow importing content into a collection. It should obviously make this kind of thing a lot easier.
Thanks for your thoughts. Was hoping to avoid something like Selenium/Webdriver but will use it if easier.
I think if you're stuffing the entire content of a page into a big CKEditor region, you're going to get up with a very unsatisfactory solution. Perch is built around the concept of structured data - you miss out on all the benefits and functionality the system can offer if you just stuff HTML into a WYSIWYG.