Creating new styles or layouts by using a JSON file | HCL Digital Experience
You can add new styles or layouts to the site toolbar with a JSON file. Sometimes components outside of the theme want to contribute a new style or layout, without editing existing theme files. Components can easily be added to the theme through a catalog deliverable by using scripting and the Solutions Installer.
Procedure
- Create new styles and layouts.
- Upload the styles or layouts to the portal. The out of box style and layout examples are in WebDAV at dav:fs-type1/themes/Portal8.5/css/ and dav:fs-type1/themes/Portal8.5/layout-templates.
- Create a JSON file to list and define the new styles and layouts. Base the style JSON file on the format in the topic Creating a theme style. The default JSON files can be used as examples and are in WebDAV at dav:fs-type1/themes/Portal8.5/system/.
- Add the new JSON files to the portal.
- Add theme metadata for each JSON file. The metadata keys
are
ibm.portal.shelf.style.json.component
andibm.portal.shelf.layout.json.component
, for the style JSON files and layout JSON files, where component can be any string that uniquely identifies the contribution. The metadata values are URLs pointing to the JSON file location. Values that start with a forward slash (/
) are treated as absolute URLs, and all other values are read relative to the theme root folder. By default, the theme root folder is in WebDAV at dav:fs-type1/themes/Portal8.5/The following example shows style and layout theme metadata for a component called myAdditions:<parameter name="ibm.portal.shelf.style.json.myAdditions" type="string" update="set"> <![CDATA[system/myNewStyles.json]]></parameter> <!-- This URL will be read relative to the theme root folder --> <parameter name="ibm.portal.shelf.layout.json.myAdditions" type="string" update="set"> <![CDATA[/myContextRoot/layouts/myNewLayouts.json]]></parameter> <!-- This is an absolute URL to a custom war file -->
- Log in to the portal and click Edit Mode.
- Verify that the new styles and layouts are present:
- If you have portal with combined cumulative
fix 8 or later, proceed as follows:
- Click the context menu for a page in the Site Manager tree view.
- Click Open Page Settings.
- Click the Style or Layout tab to view layouts or styles.
- If you have portal with Combined Cumulative Fix 7 or earlier,
proceed as follows:
- Select the Page tab.
- Then, select the Style or Layout tab.
- If you have portal with combined cumulative
fix 8 or later, proceed as follows: