Answers.Body: <p>Something along the line of this should do that:</p>
  
  <pre><code>&lt;ul&gt;
      {% for category in craft.categories.group('categoryGroupHandle') %}
      &lt;li&gt;
          {{ category.title }}
          {% for entry in craft.entries.section('sectionHandle').relatedTo(category) %}
              {% if loop.first %}&lt;ul&gt;{% endif %}
                  &lt;li&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/li&gt;
              {% if loop.last %}&lt;/ul&gt;{% endif %}
          {% endfor %}
          &lt;/ul&gt;
      &lt;/li&gt;
      {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  
  <p>Probably some bugs in here, but should be enough to get you started.</p>
  
  <p>Also probably smart to wrap this in <code>{% cache %}</code> tags, as it probably will trigger a lot of database queries.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-01T08:11:30.543Z
Answers.Text: Brilliant! Many thanks for this.  I also managed to get it working with a definition list which felt more semantic for my purposes.
Answers.UserDisplayName: Martin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-31T18:53:58.410Z
Answers.LastActivityDate: 2015-07-31T18:53:58.410Z
Answers.UserDisplayName: megatrond
Body: <p>I'm trying to create a category driven gallery. My setup (right or wrong) is this:-</p>
  
  <p>Users create a new entry within a Structure, title it, add photos and then assign the entry to a pre-defined gallery category.</p>
  
  <p>My idea is that when a visitor lands on the 'Gallery' page they see a 'grid' of latest photos (this is a question which might appear here later), with a navigation on the side which allows them to browse the other galleries (categories).</p>
  
  <p>So, how do I list out the categories and associated entries for this navigation?</p>
  
  <p>Example:</p>
  
  <ul>
  <li>Category Title One
  
  <ul>
  <li>Title of the entry1</li>
  <li>Title of the entry2</li>
  <li>Title of the entry3</li>
  </ul></li>
  <li>Category Title Two
  
  <ul>
  <li>Title of the entry4</li>
  <li>Title of the entry5</li>
  </ul></li>
  <li>Category Title Three
  
  <ul>
  <li>Title of the entry6</li>
  <li>Title of the entry7</li>
  <li>Title of the entry8</li>
  </ul></li>
  <li>Category Title Four
  
  <ul>
  <li>Title of the entry9</li>
  </ul></li>
  </ul>
  
  <p>I don't want the Category Titles to be links, just the entries within them.</p>
  
  <p>I hope this makes sense and someone can provide a solution.</p>
  
  <p>Many thanks</p>
  
  <p>Martin</p>
  
Tags: <entries><categories>
Title: List Categories AND their associated entries
ThreadText: # List Categories AND their associated entries
  
  (Asked by: username_0 on 2015-07-31)
  
  I'm trying to create a category driven gallery. My setup (right or wrong) is this:-
  
  Users create a new entry within a Structure, title it, add photos and then assign the entry to a pre-defined gallery category.
  
  My idea is that when a visitor lands on the 'Gallery' page they see a 'grid' of latest photos (this is a question which might appear here later), with a navigation on the side which allows them to browse the other galleries (categories).
  
  So, how do I list out the categories and associated entries for this navigation?
  
  Example:
  
  * Category Title One
    + Title of the entry1
    + Title of the entry2
    + Title of the entry3
  * Category Title Two
    + Title of the entry4
    + Title of the entry5
  * Category Title Three
    + Title of the entry6
    + Title of the entry7
    + Title of the entry8
  * Category Title Four
    + Title of the entry9
  
  I don't want the Category Titles to be links, just the entries within them.
  
  I hope this makes sense and someone can provide a solution.
  
  Many thanks
  
  username_0
  
  **Tags:** entries, categories
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-07-31. Score: 3 | Accepted answer
  
  Something along the line of this should do that:
  
  ```
  <ul>
      {% for category in craft.categories.group('categoryGroupHandle') %}
      <li>
          {{ category.title }}
          {% for entry in craft.entries.section('sectionHandle').relatedTo(category) %}
              {% if loop.first %}<ul>{% endif %}
                  <li><a href="{{ entry.url }}">{{ entry.title }}</a></li>
              {% if loop.last %}</ul>{% endif %}
          {% endfor %}
          </ul>
      </li>
      {% endfor %}
  </ul>
  
  ```
  
  Probably some bugs in here, but should be enough to get you started.
  
  Also probably smart to wrap this in `{% cache %}` tags, as it probably will trigger a lot of database queries.
  
  > **Comments:**
  > **username_0**: Brilliant! Many thanks for this.  I also managed to get it working with a definition list which felt more semantic for my purposes.  
  
  ---
  
  