I want to create a variable based on the contents of a matrix block. This is the code I created:
{% for item in entry.screenshot %} //my matrix field
{% for asset in item.webpage %} // an asset field in the block
{% set backgroundUrl = asset.url %} //want to declare a variable using the asset url
{% endfor %}
{% endfor %}
This throws a "backgroundUrl not defined" error when I try to use the variable. Obviously my syntax is wrong. Any advice would be appreciated!