summaryrefslogtreecommitdiff
path: root/_includes/views/segments.html
blob: 0cf9414390b3c329f2dcb883c199bad4f64bfee2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{%- if include.keys -%}
  {%- assign keys = include.keys -%}
{%- endif -%}

{%- if include.field -%}
  {%- assign field = include.field -%}
{%- endif -%}

<div class="page-segments">
  <ul class="page-segments-list">
    {% for key in keys %}
    <h2 id="{{ key }}" class="segment-name">{{ key }}</h2>
      {% assign items = site.posts | where: field, key %}
      {% for item in items %}
        {% if item != nil %}
          {%- assign post_item_class = "" -%}
          {%- if item.top -%}
            {%- assign post_item_class = "top-post" -%}
          {%- endif -%}
          <li class="{{ post_item_class }}">
            {%- include views/post-item.html -%}
          </li>
        {% endif %}
      {% endfor %}
    {% endfor %}
  </ul>
</div>