Expand my Community achievements bar.

SOLVED

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

Avatar

Level 3

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>

 

kiran_22_12_0-1670833392991.png      Publish mode doesn't show any button.

Author Mode

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

 

View solution in original post

3 Replies

Avatar

Employee Advisor

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

Avatar

Level 3

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>

Avatar

Correct answer by
Community Advisor

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