可以使用 cec create-contentlayout 命令在开发人员云服务项目中按内容类型创建内容布局。
要在开发人员云服务项目中创建内容布局,请执行以下操作:
在终端窗口中,转到 cec-components 目录。
输入 cec create-contentlayout 以查看该命令的选项和示例:
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
输入以下命令以查看服务器上可用的内容类型:
cec list-server-content-types
如 "Usage" 中所示,可以按 Oracle Content Management 服务器中的内容类型创建内容布局,也可以按 cec-components/src/main/templates 下的模板中的内容类型创建内容布局。例如,以下命令按服务器中的类型创建内容布局:
cec create-contentlayout Blog-Post-Overview-Layout -c Blog-Post -r
可以编辑以下文件来修改内容布局:
assets/layout.html
此文件指定 HTML 视图。请参见编辑 Mustache 模板中的内容布局。
assets/design.css
此文件指定内容布局的样式。请参见在 design.css 文件中定义样式。
assets/render.js
此文件指定 layout.html 中使用的数据,您可以在此文件中向内容布局添加动态行为。请参见定义 RequireJS 模块。
如果您创建了一个允许使用定制设置的布局(在创建布局时使用选项 -a),则还将创建一个名为 settings.html 的附加文件,用于提供单个内容项的默认呈现,以便可以显示它。