Create a Content Layout with Developer Cloud Service
You can create a content layout for a content type in your Developer Cloud Service project with the cec create-contentlayout
command.
To create a content layout in your Developer Cloud Service project:
-
In a terminal window, go to the
cec-components
directory. -
Enter
cec create-contentlayout
to see options and examples for the command:Usage: cec create-contentlayout <name> Creates a content layout based on a content type from a local template or from CEC server. By default, an "overview" content layout is created. Optionally specify -s <style> to create in a different style. Valid values for <style> are: detail overview Options: --contenttype, -c <contenttype> Content layout is based on [required] --template, -t <template> Content type is from --server, -r flag to indicate the content type is from server --style, -s <style> Content layout style --addcustomsettings, -a Add support for custom settings when used in Sites --help, -h Show help [boolean] Examples: cec create-contentlayout Blog-Post-Overview-Layout -c Blog-Post -t BlogTemplate cec create-contentlayout Blog-Post-Detail-Layout -c Blog-Post -t BlogTemplate -s detail cec create-contentlayout Blog-Post-Overview-Layout -c Blog-Post -t BlogTemplate -a cec create-contentlayout Blog-Post-Overview-Layout -c Blog-Post -r cec create-contentlayout Blog-Post-Overview-Layout -c Blog-Post -r -s detail
-
Enter the following command to see what content types are available on your server:
cec list-server-content-types
-
As shown in the "Usage", you can either create a content layout for the content type in the Oracle Content Management server or for the content type in the templates under
cec-components/src/main/templates
. For example, the following command creates the content layout for the type in the server:cec create-contentlayout Blog-Post-Overview-Layout -c Blog-Post -r
You can edit the following files to modify the content layout:
-
assets/layout.html
This file specifies the HTML view. See Edit the Content Layout in the Mustache Template.
-
assets/design.css
This file specifies the style for the content layout. See Define Styles in the design.css File.
-
assets/render.js
This file specifies the data used in
layout.html
and lets you add dynamic behavior to the content layout. See Define the RequireJS Module.
If you created a layout that allows for custom settings (using the option -a
when creating the layout), an additional file named settings.html
is also
created which provides a default rendering of a single content item so it can be
displayed.