Adobe建议对需要基于单页应用程序框架的客户端渲染(例如,React)的项目使用SPA编辑器。 了解更多.
AEM内容可以通过Sling默认Servlet轻松呈现,以呈现JSON和其他格式。
这些现成的呈现方式通常沿着存储库移动,并按原样返回内容。
AEM还通过Sling支持开发和部署自定义sling渲染器以完全控制渲染的模式和内容。
内容服务默认渲染器填补了现成Sling默认值和自定义开发之间的空白,允许自定义和控制呈现内容的许多方面而无需开发。
下图显示了内容服务的呈现。
使用<RESOURCE.caas[。<export-config>.][<export-config>.] jsonto请求JSON。
资源 | /content/entities 或 下的实体资源位于/content下 |
EXPORT-CONFIG | 可选 在/apps/mobileapps/caas/exportConfigs/EXPORT-CONFIG |
深度——整型 | 可选 深度递归,用于渲染Sling渲染中使用的子项 |
可以创建导出配置以自定义JSON渲染。
您可以在/apps/mobileapps/caas/exportConfigs下创建配置节点。
节点名称 | 配置的名称(用于渲染选择器) |
---|---|
jcr:primaryType | nt:unstructured |
下表显示了导出配置的属性:
名称 | 类型 | 默认值(if, not set) | 值 | 描述 |
includeComponents | String[] | 包含所有内容 | sling:resourceType | 从JSON导出中排除具有指定sling:resourceType的节点的详细信息 |
excludeComponents | String[] | 排除任何内容 | sling:resourceType | 仅包含具有指定sling:resourceType(从JSON导出)的节点的详细信息 |
excludePropertyPrefixes | String[] | 排除任何内容 | 属性前缀 | 从JSON导出中排除具有指定前缀的开始的属性 |
excludeProperties | String[] | 排除任何内容 | 属性名称 | 从JSON导出中排除指定属性 |
includeProperties | String[] | 包含所有内容 | 属性名称 | 如果excludePropertyPrefixes set else(忽略的排除属性)仅包括这些属性 |
includeChildren | String[] | 包含所有内容 | 子名称 | 从JSON导出中排除指定的子项 |
excludeChildren | String[] |
排除任何内容 | 子名称 | 仅包含从JSON导出中指定的子项,排除其他 |
renameProperties | String[] |
重命名为 | <actual_property_name>,<replacement_property_name> | 使用替换项重命名属性 |
在/apps/mobileapps/caas/exportConfigs下创建配置节点。
name | resourceTypeOverrides |
---|---|
jcr:primaryType | nt:非结构化 |
下表显示了属性:
名称 | 类型 | 默认值(if, not set) | 值 | 描述 |
<selector_to_inc> | String[] | - | sling:resourceType | 对于以下sling资源类型,不要返回默认的CaaS json导出。 将资源渲染为;以返回客户json导出 <resource>。<selector_to_inc>.json |
内容服务包括两种导出配置:
如果在所请求的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 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
请参阅以下资源,了解内容服务中的其他主题: