0 Dynamic filtering content channel items based on Attribute value 2 Ben Goshow posted 7 Years Ago I've created a defined type "Tags" for my Content Channel "Blog" and I can assign multiple Tags to a blog post.I have tried everything but I can't get the URL query/parameter filtering or Lava to allow me to then display a list of posts that have that tag assigned.
Ben Goshow 7 years ago I was able to use Nate's suggestion to parse out the active tags with another content channel view. Here's the code I used to build the select filter of unique tags, sorted by name: {% capture postTags %}{% for item in Items %}{{ item | Attribute: 'Tags'}},{% endfor %}{% endcapture %} {% assign blogTags = postTags | ReplaceLast:',','' | Split:',' | Sort %} <select name="tags" class="filter form-control"> <option selected>Tags</option> {% assign thisTag = '' %} {% for tag in blogTags %} {% if tag != thisTag %} <option value="{{ tag }}">{{ tag }}</option> {% endif %} {% assign thisTag = tag %} {% endfor %} </select>
Ben Goshow 7 years ago Thanks Nate! Btw, is there a Lava block to list out the values from my multi-select "Tags" attribute? I'm trying to create a dropdown filter so viewers can specify the tag they want to view.
Nate Hoffman 7 years ago Not that easily, the only way I would consider doing it is using the dynamic data block which requires SQL, but you would have to figure out where those values are stored and parse them out yourself. If they change enough it would probably be worth it though. You could also try to just parse out all items in your content channel in lava with an additional content channel view block and put together a list that way, that way it is only tags that are actually used, otherwise I would just hard code them for now.