Adobe建議針對需要單頁應用程式架構用戶端轉換的專案使用SPA編輯器(例如React)。 了解更多.
AEM內容可輕鬆透過Sling Default Servlets轉譯JSON和其他格式。
這些現成可用的呈現方式通常會沿儲存庫移動,並按原樣返回內容。
AEM透過Sling也支援開發和部署自訂sling轉譯器,以完全控制轉譯的架構和內容。
Content Services預設轉譯器可填補現成可用的Sling Defaults和自訂開發之間的空隙,允許自訂和控制轉譯內容的許多方面,毋需開發。
下圖顯示內容服務的轉換。
使用<RESOURCE.caas[。<export-config>.][<export-config>.] jsonto要求JSON。
資源 | /content/entities 或 下的實體資源, /content下的內容資源 |
匯出設定 | 可選 在/apps/mobileapps/caas/exportConfigs/EXPORT-CONFIG |
DEPTH-INT | OPTIONALdepth recursion for rendering of children as used in Sling rendering |
可建立匯出設定以自訂JSON轉譯。
您可以在/apps/mobileapps/caas/exportConfigs.下建立配置節點
節點名稱 | 配置的名稱(用於渲染選擇器) |
---|---|
jcr:primaryType | nt:unstructured |
下表顯示了導出配置的屬性:
名稱 | 類型 | 預設值(如果,未設定) | 值 | 說明 |
includeComponents | String[] | 包含一切 | sling:resourceType | 從JSON匯出中排除具有指定sling:resourceType之節點的詳細資料 |
excludeComponents | 字串[] | 排除 | sling:resourceType | 僅包含指定sling:resourceType自JSON匯出之節點的詳細資料 |
excludePropertyPrefixes | 字串[] | 排除 | 屬性前置詞 | 從JSON匯出排除以指定字首開頭的屬性 |
excludeProperties | 字串[] | 排除 | 屬性名稱 | 從JSON匯出排除指定的屬性 |
includeProperties | 字串[] | 包含一切 | 屬性名稱 | 如果excludePropertyPrefixes set else(忽略排除屬性)僅包含這些屬性 |
includeChildren | 字串[] | 包含一切 | 子名稱 | 從JSON匯出排除指定的子系 |
excludeChildren | String[] |
排除 | 子名稱 | 僅包含JSON匯出中指定的子系,排除其他 |
renameProperties | 字串[] |
更名 | <actual_property_name>的<replacement_property_name> | 使用替換項更名屬性 |
在/apps/mobileapps/caas/exportConfigs.下建立設定節點
名稱 | resourceTypeOverrides |
---|---|
jcr:primaryType | nt:非結構化 |
下表顯示屬性:
名稱 | 類型 | 預設值(如果,未設定) | 值 | 說明 |
<selector_to_inc> | 字串[] | - | sling:resourceType | 對於下列sling資源類型,請勿傳回預設的CaaS json匯出。 將資源轉譯為;以傳回客戶json匯出 <resource>。<selector_to_inc>.json |
Content Services包含兩種匯出組態:
如果在請求的URI中指定了配置,則將應用Content Services預設導出配置。
<resource>.caas[。<depth-int>].json
名稱 | 值 |
excludeProperties | |
excludePropertyPrefixes | jcr:,sling:,cq:,oak:,pge- |
includeProperties | jcr:text,text jcr:title,title jcr:description,description jcr:lastModified,lastModified cq:tags,tags cq:lastModified,lastModified |
includeComponents | |
excludeComponents | |
includeChildren | |
excludeChildren | |
Sling JSON覆寫 | foundation/components/image wcm/foundation/components/image mobileapps/caas/components/data/contentReference mobileapps/caas/components/data/assetlist |
此配置擴展了預設值,將子節點下的子節點分組。
<site_page>.caas.page[。<depth-int>].json
請參閱以下資源,瞭解Content Services中的其他主題: