Range problem - list content in a series - shortcode

I wrote a shortcode … but the range is wrong - in that there are no errors, but it doesn’t list anything

I have enabled the series taxonomy in config

What it looks for is series: series name in front matter on the page that you use the shortcode

my shortcode / series.html file is …

    {{ if isset .Page.Params "series" }}
       {{ $name := .Page.Param "series" }}
      <h2>What have I said about {{ humanize ($name) }}?</h2>
        <ul class="list">
        {{ range (where (index .Site.Taxonomies.series (lower $name)).Pages "Type" "in" site.Params.mainSections) }} 
            <li class="list"><a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a></li>
        {{ end }}
        </ul>
    {{ else }}
    Warning - check your series
    {{ errorf "missing value for param 'name': %s" .Position }}
    {{ end }}

Can you tell me what I did wrong?

Fixed it … using index

Now I need to read up on how / why this works:

{{ if .Page.Params.series }}
    {{ $name := .Page.Params.series }}
    <hr/>
	<p><a href="" id="series"></a>This is a post in the 
	<b>{{$name}}</b> series.<br/>
    Other posts in this series:</p>
    {{ $name := $name | urlize }}
    {{ $series := index .Site.Taxonomies.series $name }}
    <ul class="series">
    {{ range $series.Pages }}
    	<li>{{.Date.Format "Jan 02, 2006"}} -
    	<a href="{{.Permalink}}">{{.LinkTitle}}</a></li>
    {{end}}
    </ul>


    {{ else }}
    Warning - check your tags or count
    {{ errorf "missing value for param 'name': %s" .Position }}
    {{ end }}

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.