Show related entries grouped by category with category title and description Anyone able to direct me on this?
I have a page that allows you to pick related entries (cables) within the page I want to output the related entries (cables) but group them by their category. I have the following code by this is adding each cable into each category and not just the cable within the right category.

&lt;div class="container // island-bottom"&gt;
    {% set categories = craft.categories.group('cables') %}

    {# {% set cables = craft.entries.section('cables').order('title').limit(null) %} #}

    {% set cables = entry.cables %}

    {% for entry in cables %}
        {{ entry.title }}
    {% endfor %}

    {% for category in categories.relatedTo(cables) %}
        &lt;div class="cableGroup"&gt;
            &lt;h2 class="panel__title"&gt;{{ category }}&lt;/h2&gt;
            &lt;div class="cableGroup__description content // margin-bottomX2"&gt;
                {{ category.description }}
            &lt;/div&gt;

            &lt;ul&gt;
                {% for entry in cables %}
                    &lt;li class="cable"&gt;
                        &lt;a href="#{{ entry.title|camel|upper }}" data-title="{{ entry.title }} &amp;#xa;"&gt;
                            &lt;img src="/assets/img/tmp/cable.jpg" alt="{{ entry.title }}"&gt;
                            &lt;h3 class="cable__tag"&gt;{{ entry.title }}&lt;/h3&gt;
                        &lt;/a&gt;
                    &lt;/li&gt;
                {% endfor %}
            &lt;/ul&gt;

            {% for entry in cables.relatedTo(category) %}
                &lt;div id="{{ entry.title|camel|upper }}" class="modal"&gt;
                    &lt;div class="modal__close"&gt;
                        &lt;a href="#close" title="Close" class="modal__closeBtn"&gt;
                            &lt;span class="label close"&gt;&lt;span class="icon-close heavy"&gt;&lt;/span&gt;Close&lt;/span&gt;
                        &lt;/a&gt;
                    &lt;/div&gt;
                    &lt;div class="modal__content // cable__modal"&gt;
                        &lt;div class="cable__img"&gt;
                            &lt;img src="/assets/img/tmp/cable.jpg" alt="{{ entry.title }}"&gt;
                        &lt;/div&gt;

                        &lt;div class="cable__content"&gt;
                            &lt;h3 class="cable__title"&gt;
                                {{ entry.title }}
                            &lt;/h3&gt;
                            &lt;p&gt;{{ entry.cableDescription }}&lt;/p&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            {% endfor %}
        &lt;/div&gt;
    {% endfor %}
&lt;/div&gt;
Your example is a trifle confusing, but in answer to your general question about grouping entries by a category field, Tim Kelty's groupBy plugin may help.

For example:

{% set groupedEntries = allEntries|groupBy('myCategoryField.title', 'Oddments') %}
{% for categoryTitle, categoryEntries in groupedEntries %}
    &lt;h2&gt;{{ categoryTitle }}&lt;/h2&gt;

    {% for categoryEntry in categoryEntries %}
        {{ categoryEntry.title }}
    {% endfor %}
{% endfor %}