[SOLVED] Having trouble with list of authors array

My config.toml

[params.authors] [params.authors.guy1] name = "Jill Mill" [params.authors.guy2] name = "Joe Schmoe"

        <div class="authors-list">
            {{ range $index := .Site.Params.authors }}

            {{ range $key := $index }}

            <p><a href="{{ $.Site.BaseURL }}authors/{{ $key | urlize }}"><i class="fa fa-tags"></i> {{ $key }}</a></p>

            {{ end }}

            {{ end }}
        </div>

I’m having trouble w/ this Hugo syntax, but I am trying to iterate over .Site.Params.authors, and then iterate over each author and grab only the $value for $key (where $key = name) so that the $value would be the full name, “Jill Bill” or “Joe Schmoe”

And what that ‘index’ do?

{{ index $r 0 }}

for example?

Where is this documented?

{{ range $name, $items := .Site.Params.authors }} {{ range $key, $val := $items }} {{ if eq $key "name" }} <p><a href="{{ $.Site.BaseURL }}authors/{{ $val | urlize | lower }}"><i class="fa fa-tags"></i> {{ $val }}</a> </p> {{ end }} {{ end }} {{ end }}

This works, but I didn’t know I would have to use a conditional. I thought it could filter by like how php is, $array[‘key’] or something.

https://hugodocs.info/functions/index-function/

(Also soliciting feedback on the concept.)

Thank you very much! :slight_smile:

“(Also soliciting feedback on the concept.)” What does this mean? I don’t understand, sorry.

It’s a concept docs site so I’m looking for feedback on areas for improvement…

Oh yeah, I noticed that. Thanks, man! Cool new docs site. More betterer than the older one. I’ll browser and let you know. (If I understand you correctly. English is not my strength)

1 Like

Nicely done! One thing. When I middle click mouse on a link on the sidebar, it opens the new window w/ the previous windows href, not the link’s anchor.