Liferay provides powerful visual tools to create pages from fragments and widgets. That includes Content Pages, Display Pages and Page Templates. Once those pages are created it is often needed to export them so that they can be distributed or moved to a different site or environment, where they can be imported. Furthermore the export format should be open, allowing checking it into a source control system or even enabling developers to author fragment-based pages declaratively, make modifications to exported pages and validate the result before importing them.
The goal of this story is to solve this need by introducing a new format and an export mechanism everywhere there is a fragment based page. The suggested format is a JSON format (with an associated JSON schema). This format should be decoupled from the internal implementation so that we can ensure that it will still work in future versions of Liferay.
The fragment-based page definition file should contain all the information necessary to reproduce the page or page template. That includes the page structure, fragments, widgets and their configuration. The references to the fragments should use external codes and not internal ids, so that if the fragments have themselves been exported and imported into a new system, the reference will still work.
The Fragment Toolkit should support authoring the fragment-page JSON file. The export format should follow the open JSON format defined for page definitions plus a second file for display page-specific metadata. A JSON schema should be provided to allow validation of the format. This will allow developers to make modifications to the JSON files without having to import them into Liferay.