Your sites Log in Sign up Menu

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?

3 years ago, 1 replies   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 3 years ago ยท Improve this answer

Privacy Terms