Getting specific taxonomy slice with a string

Is it possible to get a slice of all pages that have a specific tag, but where that tag is passed in as a variable?

Something like:

{{ range .Site.Taxonomies.tags[$tagName] }}
  ...
{{ end }}

Iā€™m doing something like that to get a series on my top page:

<ul class="MyListClass">
  {{ $series := index .Site.Taxonomies.series "feature1" }}
    {{ range first 5 $series.Pages }}
        <li>
          <div class="MyTitleClass"><a href="{{.Permalink }}">{{ .Title }}</a></div>
          <div class="MyDateCLass">{{ .Date.Format "02 Jan, 2006" }}</div>
        </li>
    {{ end }}
</ul>

I set $series, then get the first 5 in that range for display on my top page (the main index.html template).

1 Like