Skip to content
Grav 2.0 is officially stable. Read the announcement →
Support

Show popular tags

Started by carlos 7 years ago · 0 replies · 467 views
7 years ago

Hello to All,

I would like to restrict the number of tags showed in the side bar. I would like show only the most 10 tags used. How I could modify the loop, in the following code snippet, to do that?

Any clue would be very appreciated, I don't have experience in twig.

Thanks in advance
Carlos.

TWIG
{% if taxlist %}
   <div class="tagcloud">
{% for tax,value in taxlist[taxonomy] %}
   <a href="{{ base_url }}/{{ taxonomy }}{{ config.system.param_sep }}{{ tax|e('url') }}">{{ 
   tax|capitalize }} </a>
{% endfor %}
   </div>
{% endif %}

Suggested topics

Topic Participants Replies Views Activity
Support · by Anna, 17 hours ago
1 49 10 hours ago
Support · by gtx, 1 week ago
4 227 2 days ago
Support · by Paul Hodges, 2 weeks ago
13 277 5 days ago
Support · by Anna, 3 weeks ago
9 335 1 week ago
Support · by TomW, 2 weeks ago
4 188 2 weeks ago