Hi,
I need the add the link :
<link rel="alternate" href="http://example.com" hreflang="en-us" />
like this.
So, i added the property for href as 'hrefLangTag' and hreflang as 'region'
FYI,
<sly data-sly-list.href="${properties['hrefLangTag']}" data-sly-test.spec="${properties['region']}">
<link rel="alternate" href="${href}" hreflang="${spec}"></link>
</sly>
i used the code like above.. it was adding the <link> 16 times..
Help me to resolve this,
Example - 4 link we have. it gives the result 16 links
How to iterate only using href.
Thanks,
Solved! Go to Solution.
you can try like below:
To show single item from region based on herflang item.
<sly data-sly-list.href="${properties['hrefLangTag']}" data-sly-test.spec="${properties['region']}">
<link rel="alternate" href="${href}" hreflang="${spec[hrefList.index]}"></link>
</sly>
Can you confirm which Adobe product you are using?
Views
Replies
Total Likes
Hi jantzen,
We are using AEM 6.3.3.4 .
Thanks,
Aravind
Views
Replies
Total Likes
Perfect. I'll move this question to the Adobe Experience Manager community.
Can you explain little bit more, how data is saved in repo and what is the expected output. Why are you not using below:
<link rel="alternate" href="${properties['hrefLangTag']}" hreflang="${properties['region']}"></link>
or
<sly data-sly-test.spec="${properties['region']}">
<sly data-sly-test.href="${properties['hrefLangTag']}">
<sly data-sly-test.spec="${spec || href}">
<link rel="alternate" href="${href}" hreflang="${spec}"></link>
</sly>
Views
Replies
Total Likes
Hello Aravind,
In your code snipet :-
<sly data-sly-list.href="${properties['hrefLangTag']}" data-sly-test.spec="${properties['region']}">
<link rel="alternate" href="${href}" hreflang="${spec}"></link>
</sly>
data-sly-list - This tag is used for iterating a list, so definitely it is going to print the content inside the block equal to size of the list <link rel="alternate" >.
data-sly-test - This tag is used for testing condition true or false means if ${properties['region']} is null or blank it is not going to print anything.
Now if you want to print it only single time putting condition like ${properties['region']} is not null. Then you can use below code snipet
<sly data-sly-test.spec="${properties['region']}">
<link rel="alternate" href="${properties['hrefLangTag']}" hreflang="${properties['region']}"></link>
</sly>
Views
Replies
Total Likes
Hi Arun,
For my case, take an example
i have 10 values in the field with the name of (hrefLangTag) and one more property like (region).
I want to print like
<sly data-sly-list.href="${properties['hrefLangTag']}" data-sly-test.spec="${properties['region']}">
<link rel="alternate" href="${href}" hreflang="${spec}"></link>
</sly>
1st hrefLangTag to 1st region
2nd hrefLangTag to 2nd region
....like that.
The tag like--
<link rel="alternate" href="www.google.com/.." hreflang="en-us"></link>
<link rel="alternate" href="www.yahoo.com/.." hreflang="en-uk"></link>
<link rel="alternate" href="www.adobe.com/.." hreflang="en-eu"></link>
Views
Replies
Total Likes
you can try like below:
To show single item from region based on herflang item.
<sly data-sly-list.href="${properties['hrefLangTag']}" data-sly-test.spec="${properties['region']}">
<link rel="alternate" href="${href}" hreflang="${spec[hrefList.index]}"></link>
</sly>
Views
Likes
Replies