HTL Syntax Error | Community
Skip to main content
Level 4
July 14, 2022

HTL Syntax Error

  • July 14, 2022
  • 2 replies
  • 892 views

Actually, I am trying to use the below syntax

<span data-sly-use.params="${'tagname.js' @15657401=item.productFilterTag}" class="package-uses" data-uses="${params.title}">${params.title}</span>

But getting this error

"Cannot get DefaultSlingScript: Identifier tagname.js cannot be correctly instantiated by the Use API"

 

And the tagname.js code is given below

use(function () { // you can reference the parameters via the this keyword. var resourceResolver = resource.getResourceResolver(); var tagManager = resourceResolver.adaptTo(Packages.com.day.cq.tagging.TagManager); var tag = tagManager.resolve(this.value); var name = tag.name; var title = tag.title; var pageLocale = currentPage.getLanguage(); var localizedTitle = tag.getTitle(pageLocale); return { title: title, name:name, locale:pageLocale, tag_title:localizedTitle }; });

 

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

2 replies

arunpatidar
Community Advisor
Community Advisor
July 14, 2022
Arun Patidar
Ameen_DevAuthor
Level 4
July 14, 2022

Okay @arunpatidar 

Let me try but can you please explain to me what's the js code issue.

AshwiniSathe1
Level 3
July 14, 2022

@ameen_dev Check the error logs you can find out the exact issue. Might be the issue while resolving the tagid/tagpath "item.productFilterTag"