# Range problem - list content in a series - shortcode

**URL:** <https://discourse.gohugo.io/t/range-problem-list-content-in-a-series-shortcode/26421>\
**Category:** Uncategorized\
**Created:** [June 21, 2020, 9:03pm UTC](https://discourse.gohugo.io/t/range-problem-list-content-in-a-series-shortcode/26421 "2020-06-21T21:03:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![damien1](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/damien1/32/11594_2.png) [@damien1](https://discourse.gohugo.io/u/damien1)\
**Post date:** [June 21, 2020, 9:03pm UTC](https://discourse.gohugo.io/t/range-problem-list-content-in-a-series-shortcode/26421/1 "2020-06-21T21:03:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![damien1](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/damien1/32/11594_2.png) [@damien1](https://discourse.gohugo.io/u/damien1)\
**Post date:** [June 22, 2020, 7:58am UTC](https://discourse.gohugo.io/t/range-problem-list-content-in-a-series-shortcode/26421/2 "2020-06-22T07:58:50Z")

</div>

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 }}
```

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [June 24, 2020, 7:58am UTC](https://discourse.gohugo.io/t/range-problem-list-content-in-a-series-shortcode/26421/3 "2020-06-24T07:58:51Z")

</div>

Closed on June 24, 2020, 7:58am UTC

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