Limit Range Through Taxonomy

Is it possible to only range through a limited amount of taxonomy? I’m only trying to display a certain number of taxonomy and then including a link to “view all categories”. I currently have the below code:

                {{ range $name, $taxonomy := $.Site.Taxonomies.categories }}
                    <a href="/categories{{ $name | urlize | relURL }}">{{ $name | humanize }}</a>
                <p>No blog categories just yet</p>
                {{ end }}
1 Like
{{ $items := first 5 $.Site.Taxonomies.categories }}
{{ range $name, $taxonomy := $items }}

This will show up to 5 items. If $.Site.Taxonomies.categories is smaller than 5 then only that amount is returned.

1 Like

Thank you! Been trying to figure out the syntax on where to include the “first”

1 Like

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