I want to list all categories that have an entry assigned to them, but hide the ones that are empty.
In EE I could do this show_empty="no"
But I can't see a parameter in the docs for Craft.
Currently I've found that I could use relatedTo but with passing an object with up to 600 entries it dies with caching tags :(
Is there a better way of doing this? This is what I've got at the moment:
{% set blogPosts = craft.entries({section:'blog',limit:null}).find() %}
{% for cat in craft.categories({groupId:2}).relatedTo(blogPosts) %}
<li><a href="/blog/{{cat.slug}}">{{cat.title}}</a> </li>
{% endfor %}