oo

Exporting and Importing Page Templates

Sometimes it’s easier to edit templates in a code editor. Once you’ve created a page template, you can export it, edit it locally in the editor of your choice, and then import the template back into Liferay. You can import the template into any site on the system.

For more general information about the export/import framework, see Exporting/Importing Site Pages and Content.

note

For Liferay DXP 7.4+, Page Template Collections are called Page Template Sets in the Liferay UI.

Exporting a Page Template

  1. Open the Site Menu (Site Menu) and navigate to DesignPage Templates.

  2. Select the Page Templates tab.

  3. Select the page template set that contains the desired template.

  4. Click Actions (Actions button) for the desired content page template and select Export.

    Click Export to export your page template as a ZIP file

The content page template downloads as a ZIP file to your local machine.

tip

You can export more than one content page template at once.

The last published version of the page template is always exported. If the page template has never been published, it cannot be exported.

The exported ZIP file contains these files:

  • page-template-collection.json: Includes the name of the set where the page template is saved and any other metadata.
  • An optional thumbnail file
  • page-template.json: Contains the page template name and any other metadata.
  • page-definition.json: specifies the structure and content of the Page Template.

The ZIP file may contain different types of page templates as well, like display-page-template.json, master-page.json, page-template-collection.json and page-template.json.

Importing a Page Template

  1. Open the Site Menu (Site Menu) and navigate to DesignPage Templates.

  2. Click Options (Options icon) in the Application Bar and select Import.

    The import function is located in the options menu in the Application Bar.

  3. Select the desired page template file.

    Click Replace File if you want to change it.

  4. Click Import.

    If you import an existing page template, see Importing an Existing Page Template for more information.

    To cancel the operation and go back to the page templates page, click Cancel.

    Page templates are imported as ZIP files.

  5. Once the importing process is complete, you are redirected to an import outcome page.

  6. Click Upload Another File to import another file or Done to go back to the page templates page.

Important

To transfer page templates between DXP environments, use the LAR export and import method.

Importing an Existing Page Template

If you import a page template and items from the ZIP file already exist, you can select one of three options:

Do Not Import Existing Items: Only new items are imported.

Overwrite Existing Items: Duplicated existing items are overwritten.

Keep Both: A numbered copy of existing items is imported.

Once the importing process is complete, you are redirected to an import outcome page.

Choose one of three options when you import a duplicated page template

Import Outcome Page

When users import files, they are redirected to a new page with details about the importing process.

On the import outcome page, users can see the successfully imported entries, warnings (successful imports that could cause malfunctions), and errors (entries that weren’t imported).

The import outcome page shows warnings and errors related to the importing process

Capability: