Struggling to find array in Jekyll config file (site navigation)

Viewed 1996

In my _config.yml I have:

navigation:
- text: Home
  url: index.html
- text: About
  url: about.html
- text: Blog
  url: blog.html
- text: Portfolio
  url: portfolio.html

In my default.html layout I have:

<ul class="nav-list">
  {% for link in site.navigation %}
    {% assign current = nil %}
    {% if page.url == link.url %}
      {% assign current = 'current' %}
    {% endif %}

    <li class="nav-list-item{% if forloop.first %}first{% endif %} {{ current }} {% if forloop.last %}nav-list-item-last{% endif %}">
      <a class="{{ current }}" href="{{ link.url }}">{{ link.text }}</a>
    </li>
  {% endfor %}
</ul>

For some reason, this is not working. Why might this be?

2 Answers
Related