Suggested Entries

Problem

At the bottom of a single entry template, suggest other items at random from the same Section, excluding the current entry.

Solution

{# Displays 4 random Gallery entries #}
{% for gallery in craft.entries.section('gallery').id('not '~entry.id).order('RAND()').limit(4) %}
    {% set image = gallery.coverImage[0] %}
    <div class="listing-content">
        <a href="{{ gallery.url }}">
            <img src="{{ image.getUrl('cover') }}" alt="{{ image.title }}">
        </a>
        <h4><a href="{{ gallery.url }}">{{ gallery.title }}</a></h4>
        {{ gallery.summary }}
    </div>
{% endfor %}