Exclude categories that are not associated to any entry I have a set of categories that I would like to display on a sidebar as a way to filter the list of entries displayed. However, some of those categories haven't been associated with any entries yet so clicking on that category with return 0 results. 
What is the most efficient way to exclude those categories?
You could get the entries ids, then get the categories related to those entries.
Like so:

{%- set ids= craft.entries.section('sectionHandle').ids() -%}

{%- for cat in craft.categories.relatedTo({ sourceElement: ids }).group('categoryHandle') -%}
    {{- cat.title -}}
{%- endfor -%}


That will only print categories with an entry associated with.