aem-core-wcm-components
aem-core-wcm-components copied to clipboard
Page List items shown as Teaser have invalid dataLayer date for Teaser component
Bug present as of version: 2.24.7-SNAPSHOT
When rendering List items as Teasers, the Teaser data layer object has a repo:modifyDate that is incorrect in one of two ways.
Current functionality:
- When List item refers to an internal AEM page, the
repo:modifyDateis pulled from the List (not List Item) resource - When List item refers to an external URL, the
repo:modifyDateis pulled from the List Item resource
Modifying internal AEM page links to pull from the List Item resource is not the answer, since for Child/Search/Tag options the List Item resource isn't actually a resource in the JCR.
One solution is to simply null out the value in both com.adobe.cq.wcm.core.components.internal.models.v2.PageListItemImpl#getTeaserResource and com.adobe.cq.wcm.core.components.internal.models.v4.ExternalLinkListItemImpl#getTeaserResource by adding the following lines:
overriddenProperties.put(JcrConstants.JCR_LASTMODIFIED, null);
overriddenProperties.put(JcrConstants.JCR_CREATED, null);