Lorem ipsum dolor sit amet.
2 . Dynamic Attributes
Field value to attr value, <div myAttr="#name">
If you want to use the value of a field as an attribute value you should use the sign # combined with the name of the field property.
Example:
Collection Authors has properties "name" and "jobTitle".
Then, one one concrete Author has the content:
name: John Doe
jobTitle: Art director
When rendered on the page we could see something like:
<div class="author">
<h2>John Doe</h2>
<span>Art director</span>
</div>
So, anywhere inside this HTML render, using the special #propname syntax, we can use these concrete values ("John Doe" and "Art director") as values for HTML attributes. For example data-title="#jobTitle"
<div>
<h2>John Doe</h2>
<span data-title="#jobTitle">Art director</span>
</div>
When inspected, the final HTML is rendered as
<div>
<h2>John Doe</h2>
<span data-title="Art director">Art director</span>
</div>
NOTE: In order to be able to use dynamic attributes, the field must be included in the concrete render where you want to use it. In case where you want to use the value of the field but don't want to show the field in a render, then you can define the field as meta.