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

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 2 years ago · Improve this answer

Markdown allowed
Question or feedback?
Contact us

Tags

developers 28 questions bug 14 questions posts 9 questions resolved 7 questions request 6 questions google-drive 5 questions configure 4 questions pages 3 questions added 3 questions meta 3 questions More tags →
Subscribe for changes
RSS Feed of latest questions