Expand my Community achievements bar.

SOLVED

How to declare a variable in Sightly

Avatar

Level 4

How to declare a variable in Sightly and how to pass it

Thanks in advance

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hey,

Following is the way:

<div data-sly-test.variable123="${currentPage.name}" data-sly-unwrap></div>

And can later use it like:

<div data-sly-test="${yourName}">....${variable123}</div>

Reference Post:- How to set convenience variables in sightly?

To know more about HTL (formerly known as Sightly) :- HTL introduction part 1

~kautuk



Kautuk Sahni

View solution in original post

2 Replies

Avatar

Correct answer by
Administrator

Hey,

Following is the way:

<div data-sly-test.variable123="${currentPage.name}" data-sly-unwrap></div>

And can later use it like:

<div data-sly-test="${yourName}">....${variable123}</div>

Reference Post:- How to set convenience variables in sightly?

To know more about HTL (formerly known as Sightly) :- HTL introduction part 1

~kautuk



Kautuk Sahni