Exporting and Importing Page Templates
Sometimes, it’s easier to edit templates in a code editor. After you create a page template, you can export it for local editing. Once you’ve made the necessary changes, you can import the template back into Liferay and use it in any site in the system.
For more general information about the export/import framework, see Exporting/Importing Site Pages and Content.
For exporting purposes, content page templates are fully supported, while widget page templates can’t be exported.
Exporting a Page Template
-
Open the Site Menu (), expand Design, and go to Page Templates.
-
Select the Page Templates tab.
-
Select the page template set that contains the desired template.
-
Click Actions () for the desired content page template and select Export.
The content page template downloads as a ZIP file to your local machine.
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 can’t 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
-
In the Page Templates application, click Options () in the Application Bar and select Import.
-
Select the desired page template file.
Click Replace File if you want to change it.
-
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.
-
Once the importing process is complete, you are redirected to an import outcome page.
-
Click Upload Another File to import another file or Done to go back to the page templates page.
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.
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).