0 AdRotator and Variables 1 Jackie Powers posted 7 Years Ago I'm not sure if this should go in web development or here so if it belongs in web development, I'm sorry. I added a link attribute to my content channel items so I can specify what page displays when the picture is clicked. However, I want to make it either go to the specified link or the detail page for that particular item, so I have created a few variables and tried that way. However, I cannot get my link variable to initialize properly. Is it possible to initialize a variable with another variable in Lava? If so, what have I done wrong? Here is the code I've written. linkable and detailPage do what they are intended to do (I've put those variable in the <a> instead of link). So, my issue is with the link variable. Here is the code I'm working with.{% capture linkable %} {{ item | Attribute:'Link' }} {% endcapture %}{% capture detailPage %}{{ LinkedPages.DetailPage }}?Item={{ item.Id }}{% endcapture %}{% if linkable == 'default' %}{% assign link = detailPage %}{% else %}{% assign link = linkable %}{% endif %}<a href="{{ detailPage }}">{{ item | Attribute:'Image' }}</a>
Jackie Powers 7 years ago Thank you! I ended up using capture instead and that solved my issue but yours seems much simpler so I may modify it to fit my variables.