- Home
- Build pages
- Reuse layouts
- Importing and exporting
Copy templates between sites
Move your page templates and saved sections to another site, for example from staging to live. At the end you find them there under Choose a template and in the Saved templates tab. Both kinds are Drupal configuration. Copy them one at a time in the browser, or deploy them all with your site's configuration.
Before you start
- You need the Administer site configuration permission on both sites.
- To copy single templates in the browser, the core Configuration Manager module must be enabled, and you need Export configuration and Import configuration.
Copy one template in the browser
- On the source site, go to Configuration > Development > Configuration synchronization and open Export > Single item (
/admin/config/development/configuration/single/export). - Under Configuration type, choose DXPR Builder Page Template or DXPR Builder User Templates.
- Under Configuration name, choose the template and copy the text that appears.
- On the target site, open Import > Single item (
/admin/config/development/configuration/single/import). - Choose the same Configuration type and paste the text into Paste your configuration here.
- Click Import and confirm.
The copy holds the markup, the picture and, for a user template, the global setting.
Copy by hand
No Configuration Manager? Then copy the fields one by one:
- On the source site, open the template at DXPR Studio > DXPR Builder > Page Templates (
/admin/dxpr_studio/dxpr_builder/page_template) or User Templates (/admin/dxpr_studio/dxpr_builder/user_templates). - Copy the contents of the Template field.
- On the target site, click Add page template or Add user template on the same page.
- Paste the markup into Template and fill in the other fields. A user template also needs a UID: the user ID of its owner on the target site.
- Upload the thumbnail again under Image, because it is not part of the markup.
- Click Save.
Deploy all templates with the site configuration
A full configuration export holds every template, as dxpr_builder.page_template.<id>.yml and dxpr_builder.user_template.<id>.yml. If your team deploys configuration with Drush, the templates go along:
drush config:export
drush config:import
Run the export on the source site, commit or copy the files, and run the import on the target site.
What you see
A page template you imported shows up in the Layouts dialog of an empty page. A user template shows up in the Saved templates tab. A global one sits under Global Templates; a private one shows only for its owner.
If you don't see the template
- An imported user template is missing from the picker. Its UID belongs to a user who does not exist on the new site, and the picker skips templates without an author. Edit the template at
/admin/dxpr_studio/dxpr_builder/user_templatesand enter an existing user ID. - An imported page template is not in the Layouts dialog. It is not enabled, or a user profile limits the page templates its editors may use. Tick Enabled on the template, then tick it under Page templates at
/admin/dxpr_studio/dxpr_builder/profile. - Pictures inside the template are broken. The template refers to image files in the files folder of the source site, and configuration does not copy files. Copy the files to the same folder on the new site, or pick the pictures again.
What's next?
- Start a page from a template: use the imported layouts.
- Find and insert a saved template: use the imported sections.