Data tags render blank in for loop, but length of list is rendered


#1

I have the following file [network.yaml] located in the _data folder:

- ip: 192.168.0.1
  mac: 'a4:13:4e:5e:2c:c0'
- ip: 192.168.0.4
  mac: 'b0:6e:bf:9c:11:00'

Then, I have this in [network-ip-map.html] which is in /pages/network/

<ul>
{% for ip in site.data.network %}
  <li>
   {{ network.ip }} | {{ network.mac }}
    </a>
  </li>
{% endfor %}
</ul>

The result looks like this:

  • |
  • |

No information is being rendered. Am I forgetting something?


#2

Your variable names in the loop are off. Easiest fix would be to do for network instead of for ip.

<ul>
{% for network in site.data.network %}
  <li>
   {{ network.ip }} | {{ network.mac }}
    </a>
  </li>
{% endfor %}
</ul>