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?
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">
{{#popular_tags}}
<a href="/tagged/{{slug}}">{{tag}}</a>
{{/popular_tags}}}
</div>
<style type="text/css">
.popular_tags :nth-child(n+11) {display:none}
</style>
Please let me know if you have any questions about this or anything else
Answered 3 years ago ยท Edit answer