{% comment %} Collection objects summary. Counts item types based on "display_template" providing link to Browse page. E.G. --> {% include index/objects.html %} E.G. --> {% include index/objects.html object_field="format" others=true total=true %} Options: - "btn-color" - a bootstrap color class to theme the buttons. Can be any bootstrap template color (e.g. info, success) or outline (e.g. outline-info, outline-success), including colors created in config-theme-colors. (optional, default "outline-secondary") - "heading_level" = customize the level of the heading if necessary for accessibility, choose "h1", "h2", "h3", etc (optional, default "h2") - "object_field" = optionally change the field used to count items. Typically this is either "display_template" (default) or "format". The field should be available on the Browse page to filter! The icons assume you use something like "display_template" or "format" to select the correct icon. - "child-objects" = include child items in count or only parents, true or false (optional, default false) - "others" = display a count for items with no "display_template", true or false (optional, default false) - "total" = display a count for total items, true or false (optional, default false) {%- endcomment -%} {%- assign object_field = include.object_field | default: 'display_template' -%} {% if include.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 templates = items | map: object_field -%} {%- assign types = templates | uniq | compact | sort -%}
<{{ include.heading_level | default: 'h2' | strip }} class="card-title h5">Objects

{% for t in types %} {%- assign count = templates | where_exp: 'item', 'item contains t' | size -%} {% if count > 0 %} {{ count }} {{ t | upcase | replace: "_", " " }} {% include helpers/get-icon-svg.html type="hidden" template=t %}
{%- endif -%} {%- endfor -%} {% if include.others == true %}{% assign others = templates | where_exp: 'item', 'item == nil or item == ""' | size %}{% if others > 0 %} {{ others }} OTHER {% include helpers/get-icon-svg.html type="hidden" %}
{% endif %}{% endif %} {% if include.total == true %} {{ templates | size }} TOTAL ITEMS
{% endif %} View table