Lego2012
2/3/2017 - 2:26 PM

Conditions

Conditions

<ul>
  {% for sec in site.data.samplelist.mypages %}
    {% if sec.audience == "writers" %}
      <li>{{sec.url}}</li>
    {% endif %}
  {% endfor %}
</ul>

<!--
Result:
- google.com
- apple.com
- microsoft.com
-->

<ul>
  {% for sec in site.data.samplelist.mypages %}
    {% if sec.audience == "writers" and sec.product == "gizmo" %}
      <li>{{sec.url}}</li>
    {% endif %}
  {% endfor %}
</ul>

<!--
Result:
- apple.com
-->
mypages:
- section1: Section 1
  audience: developers
  product: acme
  url: facebook.com
- section2: Section 2
  audience: writers
  product: acme
  url: google.com
- section3: Section 3
  audience: developers
  product: acme
  url: amazon.com
- section4: Section 4
  audience: writers
  product: gizmo
  url: apple.com
- section5: Section 5
  audience: writers
  product: acme
  url: microsoft.com