How to add conditional logic in sightly code for an HTML attribute
<p>I tried searching but somehow i cannot get my way around thinking what do i need to add dynamic tags inside html element using sightly code.
Not sure if this is good practice or not, but wanted to ask.
Now i know how to apply cssclass to class attribute in an href. But what if i want to inject the entire attribute "class='one'" in an href how do i do that?</p>

<p>Can this be done. I know I could do something like</p>

<pre><code>&lt;a href="${properties['jcr:titleurl']}" class="${properties.openinnewwindow ? 'nonunderline' : ''}"&gt; &lt;h3&gt;${properties['jcr:title']}&lt;/h3&gt;&lt;/a&gt;
</code></pre>

<p>but i want to do this,</p>

<pre><code>&lt;div class="col-md-12"&gt;       
&lt;a href="${properties['jcr:titleurl']}"  data-sly-test="${properties.openinnewwindow ? 'class=one' : class='two'}"&gt; &lt;h3&gt;${properties['jcr:title']}&lt;/h3&gt;&lt;/a&gt;
</code></pre>

<p></p>