so I have this piece of HTL
<div class="col-lg-6"><a href="${properties.targetURL@context='uri'}" class="black_transparent_button">View all fishes|${properties.targetURL}</a></div>
When I view the page (view as published) in my local AEM, this is the rendered HTML
<div class="col-lg-6">View all fishes|/content/myhost/en/fishes.html</div>
as can be seen, the a tag has disappeared.
I tried with/without context=uri and I get the same issue.
Any ideas what I could be doing wrong?
Thanks
edit
I also tried the code below and the a tag got stripped out as well. I have no issues when I use the full URL.
div class="col-lg-6"><a href="/content/myhost/en/fishes.html" class="black_transparent_button">View all fishes</a></div>
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
We had tried to replicate your issue with the following code snippet that you had shared with valid targetURL and invalid targetURL -
<div class="col-lg-6">
<a href="${properties.targetURL@context='uri'}" class="black_transparent_button">View all fishes|${properties.targetURL}</a>
</div>
When we used valid targetURL (/content/projectname/na/us/en.html --> This page exists in our project), output was:
<div class="col-lg-6">
<a href="https://forums.adobe.com/content/projectname/na/us/en.html" class="black_transparent_button">View all fishes|/content/projectname/na/us/en.html</a>
</div>
When we used invalid targetURL (/content/experian/na/us/enabcgefgh.html --> This page exists in our project), output was:
<div class="col-lg-6">
View all fishes|/content/experian/na/us/enabcgefgh.html
</div>
NOTE:
When we use @ context ='uri', it validates URI for writing as an href or src attribute value, outputs nothing if validation fails.
Hence anchor tag is disappearing in your rendering HTML.
Even though @ context ='uri' is not used in our code, it's taken by default by sightly and hence it's causing you the issue.
Please refer the following URL for more information:
We hope this information helps!
Regards,
Views
Replies
Total Likes
Did you have a space between the property, the @ and the context='uri' ? Because in the snippet you provided, I don't see one. Not sure if it's necessary to have one, but I always did it like that.
Views
Replies
Total Likes
Please read my edit. Thanks!
Views
Replies
Total Likes
Hi,
We had tried to replicate your issue with the following code snippet that you had shared with valid targetURL and invalid targetURL -
<div class="col-lg-6">
<a href="${properties.targetURL@context='uri'}" class="black_transparent_button">View all fishes|${properties.targetURL}</a>
</div>
When we used valid targetURL (/content/projectname/na/us/en.html --> This page exists in our project), output was:
<div class="col-lg-6">
<a href="https://forums.adobe.com/content/projectname/na/us/en.html" class="black_transparent_button">View all fishes|/content/projectname/na/us/en.html</a>
</div>
When we used invalid targetURL (/content/experian/na/us/enabcgefgh.html --> This page exists in our project), output was:
<div class="col-lg-6">
View all fishes|/content/experian/na/us/enabcgefgh.html
</div>
NOTE:
When we use @ context ='uri', it validates URI for writing as an href or src attribute value, outputs nothing if validation fails.
Hence anchor tag is disappearing in your rendering HTML.
Even though @ context ='uri' is not used in our code, it's taken by default by sightly and hence it's causing you the issue.
Please refer the following URL for more information:
We hope this information helps!
Regards,
Views
Replies
Total Likes
Views
Likes
Replies