Error with range and config.toml [solved]

I’m trying to range over an array that contains inline tables in my config.toml to insert the values in a template, but Hugo throws an error.

Excerpt from config.toml

[params.footer.social]
title = "Around the web"
networks = [
    { icon: "github", url: "//github.com/spf13/hugo" },
    { icon: "stack-overflow", url: "//stackoverflow.com/questions/tagged/hugo"}
 ]

The code from the template:

 <ul class="list-inline">
     {{ range .Site.Params.footer.social.networks }}
     <li>
          <a href="{{ .url }}" class="btn-social btn-outline"><i class="fa fa-fw fa-{{ .icon }}"></i></a>
     </li>
     {{ end }}
</ul>

And finally the error:

Error parsing config: Near line 82 (last key parsed 'params.footer.social.networks'): Expected value but found '{' instead.

Thanks you for this reference. And I thought the hole time that I use the wrong syntax. So I need to find a workaround until it’s implement.

Temporarily I’ll stick with a multidimensional array. Is it somehow possible to use a specific index of an array?

My config:

networks = [
    ["github", "//github.com/spf13/hugo"],
    ["stack-overflow", "//stackoverflow.com/questions/tagged/hugo"]
]

My approach would it be to use the indexes (which don’t work that way here):

{{ range .Site.Params.footer.social.networks }}
       <li>
             <a href="{{ .[0] }}" class="btn-social btn-outline"><i class="fa fa-fw fa-{{ .[1] }}"></i></a>
       </li>
{{ end }}

Use the index func

{{ index . 0 }}

Thanks

Hi @ all.

I have a similar question. I want to do the same, but i want to definie it in an special archtype (blog). I wrote the same syntax like digitalcraftsman. But if I try du use the index function i get nothing, no error no output. My Frontmatter looks like:

extralogos = [
[“photoshop.png”, “//adobe.com”],
[“fireworks.png”, “//adobe.com”]
]

in the archtype template (single.html) i would generate the image with the link

Thanks for the thread, the whole morning I’ve been trying to find a solution for this.