Adobe建議針對需要單頁應用程式架構用戶端轉譯(例如React)的專案使用SPA編輯器。 了解更多.
AEM內容可輕鬆透過Sling Default Servlets轉譯JSON和其他格式。
這些現成可用的轉譯功能通常會依原樣執行存放庫並傳回內容。
AEM也透過Sling支援開發和部署自訂Sling轉譯器,以完全控制轉譯的結構和內容。
「內容服務預設轉譯器」可填補現成可用的Sling預設值與「自訂開發」之間的間隙,允許自訂和控制轉譯內容的許多方面,而不需開發。
下圖顯示內容服務的呈現。
使用<RESOURCE.caas[。<export-config>.][<export-config>. jsonto要求JSON。]
資源 | /content/entities 或 下的實體資源/content下的內容資源 |
EXPORT-CONFIG | 可選 在/apps/mobileapps/caas/exportConfigs/EXPORT-CONFIG |
DEPTH-INT | OPTIONALdepth遞回,用於轉譯Sling演算中使用的子項 |
可建立匯出設定以自訂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 |
「內容服務」包括兩種匯出設定:
如果在請求的URI中指定了配置,則將應用內容服務預設導出配置。
<resource>.caas[.<depth-int>].json
名稱 | 值 |
excludeProperties | |
excludePropertyPrefixes | jcr:,sling:,cq:,oak:,pge- |
includeProperties | jcr:text,text jcr: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
請參閱下列資源,了解「內容服務」中的其他主題: