Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Bug of site variable

Started by Muut Archive 10 years ago · 1 replies · 412 views
10 years ago

I have a code like this
--- html
{% for item in site.social %}
<li>
<a href="{{ item.url }}"><i class="fa fa-{{ item.icon }}"></i>
</a>
</li>
{% endfor %}

TXT
and in site.yaml I have 

social:
url:

10 years ago

Your data is not structured correctly for that loop. You'd need something like:

YAML
social:
  - url: URL1
    icon: ICON1
  - url: URL2
    icon: ICON2

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1350 9 years ago
Archive · by Muut Archive, 9 years ago
2 935 9 years ago
Archive · by Muut Archive, 9 years ago
2 4061 9 years ago
Archive · by Muut Archive, 9 years ago
1 2948 9 years ago
Archive · by Muut Archive, 9 years ago
3 1119 9 years ago