{%- comment -%} Generates a subject cloud using js to process the terms for display on "cloud" layout. Requires CB's array_count_uniq.rb plugin! {%- endcomment -%} {% if site.data.theme.browse-child-objects == true %} {%- assign items = site.data[site.metadata] | where_exp: 'item','item.objectid' -%} {% else %} {%- assign items = site.data[site.metadata] | where_exp: 'item','item.objectid and item.parentid == nil' -%} {% endif %} {%- assign termsMin = include.min | plus: 0 | default: 1 -%} {%- assign cloud_id = include.id | default: "cloud" -%} {%- assign cloud-fields = include.fields | split: ";" -%} {%- comment -%} capture terms from all cloud fields {%- endcomment -%} {%- assign terms = "" -%} {%- for c in cloud-fields -%} {% assign new = items | map: c | join: ";" %} {% assign terms = terms | append: ";" | append: new %} {%- endfor -%} {%- comment -%} find unique terms and counts {%- endcomment -%} {%- assign uniqTerms = terms | downcase | split: ";" | array_count_uniq | sort | where_exp: 't','t[1] >= termsMin' -%}