Resources called via data-sly-resource are not visible in publish mode. | Community
Skip to main content
Level 2
December 12, 2022
Solved

Resources called via data-sly-resource are not visible in publish mode.

  • December 12, 2022
  • 1 reply
  • 1385 views

Hi Community,

I have been trying to call the button resource in my sightly, based on Count authored in dialog. The below code works fine in author mode, but in publish mode. I cannot see the buttons that I authored. 

<sly data-sly-test="${contentBlockModel.includeButtons}"  data-sly-list="${contentBlockModel.ButtonComponentsList}">
<sly data-sly-test.resourceNode="${['button', item] @join='-'}">
<sly data-sly-resource="${ @path=resourceNode,
resourceType='kiran-base/components/content/button', decorationTagName='div'}"></sly>
</sly>
</sly>

 

      Publish mode doesn't show any button.

Author Mode

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 Manu_Mathew_

@kiran_22_12 you can also use- `item.itemIndex`

 

1 reply

Adobe Employee
December 12, 2022

hi @kiran_22_12 ,

 

There is no syntax issue, So, by right button should come. I feel issue is

1) your model is not present or bundle not active in publisher 

or

2) Your content is not there.

 

Can you try printing the values directly such as 

${contentBlockModel.includeButtons}

${contentBlockModel.ButtonComponentsList}

 

Hope this helps.

 

Thanks,

Nikita Garg

Level 2
December 12, 2022

Hi nikita,

My model is present & the content is there as well. I have tried these. They work individually.

But I just solved it using the below code:

<sly data-sly-test="${contentBlockModel.includeButtons}"  data-sly-list="${contentBlockModel.ButtonComponentsList}">
<sly data-sly-resource="${'button{0}' @ format=itemList.count , resourceType='kiran/components/content/button', decorationTagName='div'}"></sly>
</sly>
Manu_Mathew_
Community Advisor
Manu_Mathew_Community AdvisorAccepted solution
Community Advisor
December 12, 2022

@kiran_22_12 you can also use- `item.itemIndex`