如何为AEM中的摘要组件中的图像添加Alt标记?

如何为AEM中的摘要组件中的图像添加Alt标记?,aem,sightly,aem-6,teaser,aem-core-wcm-components,Aem,Sightly,Aem 6,Teaser,Aem Core Wcm Components,我想在摘要组件中添加与图像组件类似的alt标记 OOTB摘要组件使用数据资源 <sly data-sly-template.image="${@ teaser}"> <div data-sly-test="${teaser.imageResource}" data-sly-resource="${teaser.imageResource}"></div> </sly> 我可以在数据资源上传递属性值吗 <div data-

我想在摘要组件中添加与图像组件类似的alt标记

OOTB摘要组件使用数据资源

<sly data-sly-template.image="${@ teaser}">
    <div data-sly-test="${teaser.imageResource}" data-sly-resource="${teaser.imageResource}"></div>
</sly>

我可以在数据资源上传递属性值吗

    <div data-sly-test="${teaser.imageResource}" data-sly-resource="${teaser.imageResource @ alt = properties.alt}"></div>

提前谢谢

AEM 6.5 2.6.0
4.1.0

在HTL Sling实现中,您可以在
数据资源上传递参数(使用请求属性-请参阅)。但是,这将要求图像的渲染了解并使用它们

在您似乎正在使用时,图像组件将尝试从中获取
alt
属性的数据。您可以包装资源,并提供一个自定义的
alt
属性来获取您需要的内容