Answers.Body: <p>A simple but effective solution would be to just wrap the output in a conditional.</p>
  
  <pre><code>{% if entryCount %}
      &lt;li&gt;...&lt;/li&gt;
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-04T12:59:20.303Z
Answers.Text: Oh that is super simple. Excellent, thanks!
Answers.UserDisplayName: sarah3585
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-04T12:32:17.943Z
Answers.LastActivityDate: 2016-04-04T12:32:17.943Z
Answers.UserDisplayName: carlcs
Body: <p>I'm grabbing a list of categories and displaying their entry count.
  How can I only display categories which have entires? So I'm not getting any with 0 in them, which is occurring as I have a few entries not yet published with new categories.</p>
  
  <pre><code>{% nav category in craft.categories.group('insights') %}
  {# Get the count of entries related to `category` #}
  {% set entryCount = craft.entries.relatedTo(category).total() %}
      &lt;li&gt;
          &lt;a href="{{ category.url }}"&gt;{{ category.title }} ({{ entryCount }})&lt;/a&gt;
      &lt;/li&gt;
  {% endnav %}
  </code></pre>
  
Tags: <categories>
Title: Display categories which only contain entries
ThreadText: # Display categories which only contain entries
  
  (Asked by: username_0 on 2016-04-04)
  
  I'm grabbing a list of categories and displaying their entry count.
  How can I only display categories which have entires? So I'm not getting any with 0 in them, which is occurring as I have a few entries not yet published with new categories.
  
  ```
  {% nav category in craft.categories.group('insights') %}
  {# Get the count of entries related to `category` #}
  {% set entryCount = craft.entries.relatedTo(category).total() %}
      <li>
          <a href="{{ category.url }}">{{ category.title }} ({{ entryCount }})</a>
      </li>
  {% endnav %}
  
  ```
  
  **Tags:** categories
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-04-04. Score: 3 | Accepted answer
  
  A simple but effective solution would be to just wrap the output in a conditional.
  
  ```
  {% if entryCount %}
      <li>...</li>
  {% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: Oh that is super simple. Excellent, thanks!  
  
  ---
  
  