sling model | Community
Skip to main content
Level 2
April 26, 2022
Solved

sling model

  • April 26, 2022
  • 3 replies
  • 1120 views

htl code to get link on a page injected by sling model .  provided below snapshot of my htl code,  I am doing right way?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by MayurSatav

Hi @dvaraka ,

 

What is the exact issue? Do you want to add an extension to your injected URL ? or URL itself is not getting injected? Could you please give us more clarity on this? and please share your sling model also.

 

One more thing why you are passing ${textmodel.customtextarea} in href? it should be ${textmodel.link}.

 

Thanks

3 replies

Ravi_Pampana
Community Advisor
Community Advisor
April 26, 2022

Hi,

 

Use @2941342='html'  or uri for anchor tags

 

Adds the html extension to a path.

<a href="${item.path @ extension = 'html'}">${item.name}</a>

For more information about context attributes, you can refer below link

https://experienceleague.adobe.com/docs/experience-manager-htl/using/htl/expression-language.html?lang=en

 

MayurSatav
Community Advisor and Adobe Champion
MayurSatavCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
April 27, 2022

Hi @dvaraka ,

 

What is the exact issue? Do you want to add an extension to your injected URL ? or URL itself is not getting injected? Could you please give us more clarity on this? and please share your sling model also.

 

One more thing why you are passing ${textmodel.customtextarea} in href? it should be ${textmodel.link}.

 

Thanks

VeenaVikraman
Community Advisor
Community Advisor
April 27, 2022

@dvaraka As @mayursatav mentioned , you are actually printing the wrong property in the link. Instead of ${textmodel.custometextarea} you should use the property name you have given to the link field .