Skip to main content
David_Woollard
Level 2
Oct 16, 2015 2:27 AM UTC
Solved

Extra parameters in data-sly-resource

I am trying to implement something which I hope is relatively straight forward...  I have one component (lets call it the wrapper component) which contains another component (lets call it the inner component) inside it via the data-sly-resource tag:

<div data-sly-resource="${ 'inner' @ resourceType='/projectname/components/inner' }"></div>

I would like to pass in some additional parameters with this tag, specifically a parameter that can be picked up by sightly in the inner component template?  I am trying to specify whether the inner templates outer html tag is unwrapped based on a parameter being passed in when the component is called via data-sly-resource.

After experimenting and perusing the sightly documentation, I can't find a way of achieving this.

Does anyone know if this is possible?

Many thanks,

Dave

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Feike_Visser1
Feike_Visser1Accepted solution
Adobe Employee
Oct 16, 2015 2:27 AM UTC

<div data-sly-resource="${ 'inner' @ resourceType='/projectname/components/inner', selectors='different' }"></div>

What you can do is the following:

you have your inner.html as the default, now you create a different.html file in your component. This will be used when the selector='different' is specified.

Or what you can do is to do a check in a WCMUse class whether a specific selector is specified.

Can you test the first approach?

best,

Feike

13 replies

edubey
Level 10
Jan 6, 2018 11:18 AM UTC

It has been documented here in helpx under Request Attributes section

https://helpx.adobe.com/experience-manager/htl/using/block-statements.html

Sample code

<sly data-sly-use.settings="com.adobe.examples.htl.core.hashmap.Settings"

        data-sly-include="${ 'productdetails.html' @ requestAttributes=settings.settings}" />

Translate
tobiasn29237871
Jan 6, 2018 6:39 PM UTC

Great, thanks!

Translate
akashs51893872
Level 3
Feb 27, 2018 8:23 AM UTC

Hello,

Here's an example on implementation with HTL (formerly Sightly) Passing request attributes with Sightly · GitHub.

Good Luck...

Translate