內容片段範本 content-fragment-templates
建立內容片段時會選取範本。 它們為新片段提供基本結構、元素和變數。 用於內容片段的範本須受限於Granite Configuration Manager。
現成可用的範本位於下:
/libs/settings/dam/cfm/templates
您可以在下列位置建立內容片段的網站專屬範本:
-
/apps/settings/dam/cfm/templates
用於覆蓋現成範本或提供客戶特定、應用程式範圍範本(不打算在執行階段擴充/變更)的位置。 -
/conf/global/settings/dam/cfm/templates
必須在執行階段變更的執行個體範圍客戶特定範本的位置。
優先順序為(以遞減順序) /conf、/apps、/libs。
/libs路徑中的任何專案。/libs的內容會被覆寫(當您套用Hotfix或Feature Pack時,這些內容很可能會被覆寫)。-
在
/apps下重新建立必要專案(亦即,它存在於/libs中) -
在
/apps中進行任何變更
範本的基本結構儲存在下方:
conf
global
settings
dam
cfm
templates
<template-name>
...
特定結構為:
+ <template-name>
- jcr:primaryType
- jcr:title
- jcr:description
- initialAssociatedContent
- precreateElements
- version
+ elements
- jcr:primaryType
+ <element-name>
- jcr:primaryType
- jcr:title
- defaultContent
- initialContentType
- name
... + other element definitions
+ variations
- jcr:primaryType
+ <variation-name>
- jcr:primaryType
- jcr:title
- jcr:description
- name
... + other variation definitions
有關節點及其屬性的更多詳細資訊如下:
-
範本
table 0-row-3 1-row-3 2-row-3 3-row-3 4-row-3 5-row-3 6-row-3 html-authored 名稱 類型 值 <template-name>nt:unstructured此節點是每個範本的根。 此為必填欄位,且應具有唯一名稱。 jcr:titleString必要
範本的標題(顯示在 建立片段 精靈中)。 jcr:descriptionString可選
說明範本用途的文字(顯示在 建立片段 精靈中)。 initialAssociatedContentString[]可選
一個陣列,內含的集合路徑依預設應關聯至新建立的內容片段。 precreateElementsBoolean必要
true,表示內容片段之元素(主要元素除外)的子資產是否應在內容片段建立時建立;false 表示這些子資產是否應「即時」建立。附註:此引數目前必須設定為
true。versionLong必要
內容結構的版本;目前支援:
附註:此引數目前必須設定為
2。 -
元素
table 0-row-3 1-row-3 html-authored 名稱 類型 值 elementsnt:unstructured必要
包含內容片段元素定義的節點。 它是強制性的,而且至少必須包含 Main 專案的子節點,但可以包含[1.n]個子節點。
使用範本時,元素子分支會複製到片段的模型子分支。
系統會自動將第一個元素(在CRXDE Lite中檢視)視為 主要 元素;節點名稱不相關,且節點本身除了由主要資產表示外,並無特殊意義;其他元素則會處理為子資產。
-
元素名稱
table 0-row-3 1-row-3 2-row-3 3-row-3 4-row-3 5-row-3 html-authored 名稱 類型 值 <element-name>nt:unstructured此節點會定義元素。 此為必填欄位,且應具有唯一名稱。 jcr:titleString必要
元素的標題(顯示在片段編輯器的元素選取器中)。 defaultContentString可選
預設值:「」
元素的初始內容;僅在 precreateElements=true時使用initialContentTypeString可選
預設:
text/html專案的初始內容型別;僅在
precreateElements=true時使用;目前支援:text/htmltext/plaintext/x-markdown
nameString必要
元素的內部名稱;對片段型別而言必須是唯一的。 -
變數
table 0-row-3 1-row-3 html-authored 名稱 類型 值 variationsnt:unstructured可選
此選用節點包含內容片段初始變數的定義。 -
變數名稱
table 0-row-3 1-row-3 2-row-3 3-row-3 html-authored 名稱 類型 值 <variation-name>nt:unstructured如果有變數節點,則必須填寫此項
定義初始變數。
依預設,此變數會新增至內容片段的所有元素。變數將與個別元素有相同的初始內容(請參閱
defaultContent/ initialContentType)
jcr:titleString必要
變數的標題(顯示在片段編輯器的 變數 索引標籤(左側邊欄)中)。 jcr:desciptionString可選
預設值:「」
提供變數說明的文字(顯示在片段編輯器的 變數 索引標籤(左側欄)中)。