Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Need Clarification in data-sly-resource

Level 2
Level 2

Hi Need to understand what is meaning of below line of code

<div data-sly-resource="${@path='FirstDivHeader', resourceType='foundation/components/parsys'}">

What is Used of @path in ablove example.

3 Replies

That is for manipulating the path of the resource. Please see the following document:

HTL Block Statements


As per my understanding, this means rendering a resource which is located at path FirstDivHeader and has a resourcetype of "foundation/components/parsys"

More details below:


  • Includes a rendered resource.
  • Element: always shown.
  • Content of element: replaced with the content of the resource.
  • Attribute value: required; the path to include.
  • Attribute identifier: none.

Includes a rendered resource from the same server, using an absolute or relative path. An implementation should create a new request context when retrieving the output.

Note: this is comparable to a <jsp:include page="" />.

<section data-sly-resource="./path"></section>

With an expression more options can be specified:

<!--/* Following statements are equivalent: */--> 
<section data-sly-resource="./path"></section>
<section data-sly-resource="${'./path'}"></section

/* Manipulating the path: */-->

<section data-sly-resource="${'my/path' @ appendPath='appended/path'}"></section>
<section data-sly-resource="${'my/path' @ prependPath='prepended/path'}"></section

/* Manipulating selectors: */-->

<section data-sly-resource="${'my/path' @ selectors='selector1.selector2'}">
</section> <section data-sly-resource="${'my/path' @ selectors=['selector1', 'selector2']}">
</section> <section data-sly-resource="${'my/path' @ addSelectors='selector1.selector2'}">
</section> <section data-sly-resource="${'my/path' @ addSelectors=['selector1', 'selector2']}">
</section> <section data-sly-resource="${'my/path' @ removeSelectors='selector1.selector2'}"></section>
<section data-sly-resource="${'my/path' @ removeSelectors=['selector1', 'selector2']}"></section>
<section data-sly-resource="${'my/path' @ removeSelectors}"></section

/* Forcing the type of the rendered resource: */-->

<section data-sly-resource="${'./path' @ resourceType='my/resource/type'}"></section>

The scope of the data-sly-resource statement isn't passed to the template of the included resource.

Community Advisor
Community Advisor


The use of "path" attribute in "data-sly-resource" :

When a component with the above snippet is included in a page, we would see a parsys being displayed and when we add any components within the parsys placeholder, behind the scene in the CRXDE, we would see the components available in the node hierarchy like below.

Let's say the page path is /content/xyx/abc.html

In CRXDE,  /content/xyx/abc/jcr:content/FirstDivHeader/componentname(that you would have included in that parsys)

In brief, it is part of the path with respect to the page where this snippet/component is being used.