Sightly check the url validation using sling model
Hi,
I have written some logic in the slingmodel and also i tried using sightly but due to syntax issue might be it is not working. I have tried 2 ways but it is not working.
problem statment: if the url is internal then we need to add extension as html and if url is external we do not add any extension.
@Inject @Optional
private String path;
public boolean isexternalurl(){
return StringUtils.startsWith(path,"/content");
}
Sightly :
option 1:
<div data-sly-set.pathval="${model.path @extension='html'}">
</div>
<a href="${model.Isexternalurl ?'pathval':'model.path'}">
</a>
option 2:
<div data-sly-set.pathval="${model.path @extension='html'}">
</div>
<p><a href="${'/content/'in model.path ?'pathval':'model.path'}">Visit W3Schools.com!</a></p>

