[solved] Can I limit taxonomy pages within a directory? (directory aka section)

Found the solution. Since these directories are called section. I got it working through

Part of the solution was used from some other answer in the same forum.

With this, I could make a widget kind of which takes categories from the site and limits them to blog section of which it limits to 5 entries.

{{ range $taxonomyname, $taxonomy := .Site.Taxonomies }}
  {{ if eq "categories" $taxonomyname }}
    {{ range $key, $value := $taxonomy }}
    {{ if ge (where $value.Pages "Section" "blog") 1 }}
    <div class="col-md-3 col-sm-6 col-xs-12">
      <h4 class="text-center">{{ $key }}</h4>
      <ol>
      {{range first 5 (where $value.Pages "Section" "blog") }}
        <li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
      {{ end }}
      </ol>
    </div>
    {{ end }}
    {{ end }}
  {{ end }}
{{ end }}

2 Likes