[SOLVED] Iterate over several taxonomies

Bear with me, I know just enough to be dangerous…I have multiple array taxonomies representing speaker, title, email, website, bio within each event post.

Example:

+++
speakername = ["Stacy Cook","Evangeline Harris"]
speakertitle = ["Managing Consultant","Senior Consultant"]
+++

So in my speaker template, I have:

{{ range $index, $element := $.Params.speakername }}
      {{ $title := index $.Params.speakertitle $index }}
          <div>
            <p>
              <span>
                {{ index $.Params.speakername $index }} 
                {{ with $.Params.speakertitle }}
                  &#x02016;
                {{ end }}
              </span> 
                {{ $title }}
            </p>
          </div>
      {{ end }}

This prints what I want: http://cl.ly/2S453G0u1Q22

BUT, I’m getting an error that says: ERROR: 2016/07/03 reflect: call of reflect.Value.Type on zero Value in theme/partials/event/speaker_new.html

ideas??

So on this, I noticed this issue on github, could this be the same problem, since I’m using the index?

Have you figured out which line in particular is throwing the error? It all looks right to me.

I haven’t, running hugo verbose didn’t show any more error information and nothing printed to the log.

So I figured it out. I had several posts already created and THOSE did not all have the taxonomies that I created in an array format [""] which created the error. Once I updated all of the pages, no more errors.

I also added a check for each parameter, as well as a check on the array length to avoid “index out of range” errors, which I gleaned from this icarus theme issue.

I saved the finished page to a gist: https://gist.github.com/justrjlewis/824bcde072b587eb5ccc6603423818ad

The correct link for your gist is https://gist.github.com/justrjlewis/824bcde072b587eb5ccc6603423818ad

:wink:

Oh crap - thanks!