Hi Everyone,
I have overridden core teaser component into my project to add some custom fields in dialog level, there is no major changes in sightly. If I configure redirection url in dialog then it's redirecting properly as per the configuration.
But I didn't configure any redirection link in teaser dialog level, then it's taking current page path for redirection. I couldn't see any solutions so please folks help me with this to resolve this issue asap.
example: If I configured teaser component in our story page then markup will be like this.
<div class="cmp-teaser__image">
<div>
<a class="cmp-image__link" href="/content/proj/us/en/our-story.html" data-cmp-clickable="">
<picture>
<source media="(max-width:767px)" srcset="">
<img src="" loading="lazy" class="cmp-image__image" itemprop="contentUrl" alt="alttxt">
</picture>
</a>
<!--/* <span class="cmp-image__title" itemprop="caption" data-sly-test="false"></span>
<meta itemprop="caption" content="" data-sly-test=""> */ -->
</div>
</div>
I have found this portion of markup is coming from core image component[image component called in teaser markup], there no issue because If I have authored image component I am not facing this kind of issue.
CC: @kautuk_sahni @VeenaVikraman @aanchal-sikka @EstebanBustamante
Solved! Go to Solution.
Views
Replies
Total Likes
Guys, I got a solution - In teaser design dialog there will be one checkbox field called Don't link the image, after enabling this current page path is not appending in href.
If I configure custom link then it's redirecting to this link
@arunpatidar can you verify this whether it's correct or not?
Hi @jeromeleslyv
Please try this way : modify the logic in your overridden teaser component to handle the case when no redirection link is configured. Instead of using the current page path for redirection, you can specify a default fallback URL or simply disable the redirection.
// Check if a redirection link is configured in the dialog
String redirectionLink = properties.get("redirectionLink", String.class);
if (StringUtils.isNotBlank(redirectionLink)) {
// Redirect to the configured link
response.sendRedirect(redirectionLink);
} else {
// Handle the case when no redirection link is configured
// You can specify a default fallback URL or disable the redirection
// For example, you can render the teaser component without the link
// or display a message indicating that no redirection is available.
}
By modifying the logic in your overridden teaser component, you can control the behavior when no redirection link is configured in the dialog.
This is not from teaser component, it's from the image component i.e teaser component calling image component for asset section
@jeromeleslyv I hope you might have done this , but could you confirm if you have checked the default teaser component behaviour in the same enviornment for the same scenarios ? If it is working as expected then it is to do with some of your changes. Also could you confirm the AEM version you are working on ?
Thanks
Veena ✌
I am using AEM cloud verison, It's working with core teaser component
I got to know one thing - If I doesn't configure title in teaser dialog then only its taking current path otherwise it's not coming. Is it OOTB behaviour?
If yes cany OOTB way to disable this?
@VeenaVikraman @Raja_Reddy @kautuk_sahni @arunpatidar
Hi @jeromeleslyv
Which version of AEM and core components are you using?
Here is the OOTB code for image - https://github.com/adobe/aem-core-wcm-components/blob/main/content/src/content/jcr_root/apps/core/wc...
Guys, I got a solution - In teaser design dialog there will be one checkbox field called Don't link the image, after enabling this current page path is not appending in href.
If I configure custom link then it's redirecting to this link
@arunpatidar can you verify this whether it's correct or not?
Hi @jeromeleslyv
This is valid only for Teaser version 1
https://experienceleague.adobe.com/docs/experience-manager-core-components/using/wcm-components/v1-c...
I think with Version 2 , there is no settings for auto linking
I am overriding teaser v2 only, But it's working when I have added in design dialog. Will it impact anything?
Hi @jeromeleslyv
I don't see any side effect,
I think it is ok to add design dialog if that property is used by component otherwise it will be a unused/unnecessary.
@jeromeleslyv Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
Views
Likes
Replies