呈现和交付 rendering-and-delivery

NOTE
Adobe建议对需要基于单页应用程序框架的客户端渲染(例如React)的项目使用SPA编辑器。 了解详情

Adobe Experience Manager (AEM)内容可以通过以下方式轻松渲染 Sling默认Servlet 要渲染 JSON 和其他格式。

这些开箱即用的渲染通常在存储库中导航,并按原样返回内容。

通过Sling,AEM还支持开发和部署自定义sling渲染器,以完全控制渲染的架构和内容。

Content Services默认呈现器填补了开箱即用的Sling默认设置和自定义开发之间的空白,允许在不进行开发的情况下自定义和控制呈现内容的许多方面。

下图显示了内容服务的渲染。

chlimage_1-15

请求JSON requesting-json

使用 <resource.caas span="" id="1" translate="no" />.[<export-config span="" id="0" translate="no" />.][<export-config span="" id="0" translate="no" />.json 以请求JSON。]

资源
/content/entities下的实体资源

/content下的内容资源
EXPORT-CONFIG

可选

/apps/mobileapps/caas/exportConfigs/EXPORT-CONFIG下的导出配置

如果忽略,则应用默认导出配置

DEPTH-INT
可选

用于呈现子项的深度递归,如Sling呈现中所用

创建导出配置 creating-export-configs

可创建导出配置以自定义JSON渲染。

您可以在下创建配置节点 /apps/mobileapps/caas/exportConfigs.

节点名称
配置的名称(用于呈现选择器)
jcr:primaryType
nt:unstructured

下表显示了“导出配置”的属性:

名称
类型
默认(如果,未设置)
价值
描述
includecomponents
String[]
包括所有内容
sling:resourceType
从JSON导出中排除具有指定sling:resourceType的节点的详细信息
excludecomponents
String[]
不排除任何内容
sling:resourceType
仅包含具有来自JSON导出的指定sling:resourceType的节点的详细信息
excludePropertyPrefixes
String[]
不排除任何内容
属性前缀
从JSON导出中排除以指定前缀开头的属性
excludeproperties
String[]
不排除任何内容
属性名称
从JSON导出中排除指定的属性
includeProperties
String[]
包括所有内容
属性名称

如果设置了excludePropertyPrefixes
这包括指定的属性,尽管与要排除的前缀匹配,

else(忽略排除属性)仅包括这些属性

includeChildren
String[]
包括所有内容
子名称
从JSON导出中排除指定的子项
excludechildren
String[]
不排除任何内容
子名称
从JSON导出中仅包括指定的子项,排除其他
renameProperties
String[]
不重命名任何内容
<actual_property_name>,<replacement_property_name>
使用替换重命名属性

资源类型导出覆盖 resource-type-export-overrides

在下创建配置节点 /apps/mobileapps/caas/exportConfigs.

name
resourceTypeOverrides
jcr:primaryType
nt:unstructured

下表显示了这些属性:

名称
类型
默认(如果,未设置)
价值
描述
<SELECTOR_TO_INC>
String[]
-
sling:resourceType
对于以下sling资源类型,请勿返回默认的CaaS json导出。
通过将资源呈现为,返回客户json导出;
<resource>.<selector_to_inc>.json

现有Content Services导出配置 existing-content-services-export-configs

Content Services包括两种导出配置:

  • 默认(未指定配置)
  • 页面(渲染站点页面)

默认导出配置 default-export-configuration

如果在请求的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

页面导出配置 page-export-configuration

此配置扩展了缺省设置,以包含子节点下的分组子节点。

<site_page>.caas.page[.<depth-int>].json

其他资源 additional-resources

请参阅以下资源,了解内容服务中的其他主题:

recommendation-more-help
2eeeb575-8007-40cc-a72d-206fbc4ddd4b