Developer Cloud Serviceを使用したコンテンツ・レイアウトの作成
cec create-contentlayout
コマンドを使用して、Developer Cloud Serviceプロジェクトでコンテンツ・タイプのコンテンツ・レイアウトを作成できます。
Developer Cloud Serviceプロジェクトでコンテンツ・レイアウトを作成するには:
-
ターミナル・ウィンドウで、
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
-
「使用法」に示すように、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
という名前の追加ファイルも作成され、単一のコンテンツ・アイテムを表示できるように、そのアイテムのデフォルト・レンダリングが提供されます。