Altering templates without losing data


We are redesigning a landing page template for a client, with around 900 pages using this template.

The modules within the new template are much simpler, it will probably just be a single rich text module - we are integrating with the Algolia search platform and would like to have a single module that we index along with the title, description etc.

How do we go about migrating the pages onto the new template without losing the content? We need to get the content of the old modules into this single new module, then the indexing can commence and over time the client can review the copy and make it clearer and simpler.

I think if you change templates and the new template does not contain the same module names, the content of those modules is lost, is this correct? If you switch back does the content come back?

I have been racking my brains here - was thinking perhaps the following:

  1. Add the new module to the existing template
  2. Run a script that uses the pages API, grabs the content from the old modules, copies it to the new module, then using the update endpoint, updates the pages to reflect this
  3. Check everything has worked, and if so, delete the old modules.

Would this work? Any other suggestions?

Thanks in advance.


Hi @craigivemy,

That is tricky; content could certainly be lost if you change a page's template & the modules don't match up. Your solution sounds like it would work; so long as the new module is added to the existing template and doesn't replace the existing modules, there shouldn't be any risk of content loss. The steps you outlined seem to ensure that there will be minimal risk, and might be the best way to go.

That said, I haven't personally performed or overseen a migration of this size. Usually, we recommend using the Content Staging tool, but I'm not even sure that would be functional for ~900 pages to be migrated. I've included the doc below in case you want to check it out. In this case, I would strongly suggest testing your script out on a single test page (with the content saved locally) before repeating the process automatically for all of your pages.


Hi @Derek_Gervais thanks for the reply. Couple of follow up questions then:

  1. Is it possible to run API requests against content staging only? And I mean not just one page but try the process on the whole of content staging?

  2. Is there any way to backup landing pages and restore if anything does go wrong?




Hi @craigivemy,

Unfortunately there isn't currently a Content Staging API. Backing up landing/website pages is generally handled by revision history, which includes versions after a template change. I did some testing in my own portal, and the revision history preserves older versions that use different templates. This means that you should be able to revert your pages back to older versions using the original templates if need be. If you're pulling the content of the original pages, you could theoretically store that externally (e.g. on your servers) if that would provide an increased level of security.