{%- assign actual_related = nil %} {%- for section in page.related_pages %} {%- unless section[1].size == 0 %} {%- assign actual_related = 1 %} {%- endunless %} {%- endfor %} {%- if actual_related != nil %}

Related pages

{%- if page.related_pages %} {%- for section in page.related_pages %} {%- unless section[1].size == 0 %}
{{ section[0] | replace: "_", " " | capitalize }}
{%- for page_id in section[1] %} {%- assign section_pages = site.pages | where:"type", section[0] %} {%- assign metadata = section_pages | where:"page_id", page_id %} {%- for page_hit in metadata %} {{page_hit.title}}{% if page_hit.description %}
{{ page_hit.description }}{% endif %}
{%- endfor %} {%- endfor %}
{%- endunless %} {%- endfor %} {%- endif %}
{%- endif %}