Log in Sign up

How can I customise the number of items in a list?

I have display popular_tags on my home page. I want to limit it to the top 10 or 15 most popular tags. How can I do that?

1 replies Asked Jun 27 '21 at 16:23 · Improve this question

It’s not possible to do this in the template engine itself at the moment. However, you can use CSS to accomplish this, specifically, this n-th child rule courtesy of CSS tricks.

Here’s a complete example which should show the top 10 most popular tags:

<div class="popular_tags">
<a href="/tagged/{{slug}}">{{tag}}</a>
<style type="text/css">
.popular_tags :nth-child(n+11) {display:none}

Please let me know if you have any questions about this or anything else

Answered Jun 28 '21 at 15:32 · Improve this answer

Please, log in to add a reply.