{% assign media = artists | concat:books | concat:genres | concat:movies | concat:posts | concat:shows %} {% if media.size > 0 %}
{% assign sections = "artists:headphones:music:Related artist(s):true," | append: "books:books:books:Related book(s):true," | append: "genres:headphones:music:Related genre(s):false," | append: "movies:movie:movies:Related movie(s):true," | append: "posts:article:article:Related post(s):false," | append: "shows:device-tv-old:tv:Related show(s):true" | split:"," %} {% for section in sections %} {% assign parts = section | split:":" %} {% assign key = parts[0] %} {% assign icon = parts[1] %} {% assign css_class = parts[2] %} {% assign label = parts[3] %} {% assign hasGrid = parts[4] == "true" %} {% assign items = nil %} {% case key %} {% when "artists" %} {% assign items = artists %} {% when "books" %} {% assign items = books %} {% when "genres" %} {% assign items = genres %} {% when "movies" %} {% assign items = movies %} {% when "posts" %} {% assign items = posts %} {% when "shows" %} {% assign items = shows %} {% endcase %} {% if items and items.size > 0 %}

{% tablericon icon %} {{ label }}

{% if hasGrid %} {% assign shape = "square" %} {% if key == "books" or key == "movies" or key == "shows" %} {% assign shape = "vertical" %} {% endif %} {% render "media/grid.liquid", data:items, shape:shape %} {% else %} {% endif %} {% endif %} {% endfor %}
{% endif %}