Importing existing content

Some pointers on how to start with data from other MODX installs or Wordpress. In the end, each content migration is unique and will probably require some additional customization.

Tip: use the Gitify backup and restore commands to quickly create snapshots and undo changes.

Import content from Revolution

This can be done in a Romanesco project, but will only work with existing resources. Chunks, snippets and TVs can not be copied without changing their IDs. If you keep an eye on the following, I think you'll be ok:

  • It's probably best to copy the resources directly into the database.
  • Perform this action before you install the Romanesco Backyard package, since this will also generate new resources.
  • After copying, you may want to change the template IDs for each resource, since those probably no longer match the templates you used in the old installation. You can do this with the following SQL query:
UPDATE modx_site_content SET value = '1' WHERE template = 'XX'
  • You can keep it simple by assigning the BasicOverview template to all resources as starting point, or check out the available templates and already give old blog articles or portfolio pages a corresponding Romanesco template.
  • If you weren't using ContentBlocks before, then your newly imported content doesn't know yet that it's living inside a ContentBlocks container now. Unfortunately, the only way to address this is to open each resource in the manager and save it 1 time (Quick Edit won't work here!). This generates the necessary ContentBlocks formatting inside the properties column of the site_content table. The old content will automatically be placed inside the default block (probably Rich Text).

Import content from Evolution

If you are importing content from MODX Evolution, there's a few extra differences to attend to:

  • Be careful not to copy the old data structure of the database table into the new Revolution database.
  • Contexts are referenced by ID in Evo, so you'll have to change all context_key values from '1' to 'web' (or additional context if applicable). You can use a similar SQL update query as shown above.
  • The class_key column wasn't there in Evo yet, so you'll have to add a value there for each resource to indicate what type of document it is. Probably 'modResource'.
  • Internal links have a different syntax in Evo: [~45~]. If you want to retain them, you'll have to do a find/replace action so that [~ becomes [[~ and ~] becomes ]].

Import content from Wordpress

I've had some success with adapting a script from James Ehly:

<script src="https://gist.github.com/hugopeek/c53af9dfe5cc546dac1c88d616664865.js"></script>

It adds all post to the resource tree, but without proper nesting.

Closing comments

There's probably stuff I'm forgetting here still, plus it completely ignores information inside TVs, chunks or other elements, as well as dynamic content and settings and such. But I hope these pointers will get you up and running at least, and provide you with a good starting point to revamp your old project into something shiny and refreshed.