Related Entries Filter

Free!
Download
Description

StyleCI SensioLabsInsight

Entries are filtered by overlapping/intersecting terms.

Installation

Copy the Related folder to your site/addons folder

Example usage

Show related entries based on the current entry by passing the tags (:rel_terms="tags_raw")

{{ collection:blog slug:isnt="{slug}" filter="Related" rel_taxonomy="tags" :rel_terms="tags_raw" as="items"}}
{{ unless no_results }}
    <section class="related">
        <h2>Related</h2>
        {{ items }}
            {{ partial:blog/item }}
        {{ /items }}
    </section>
{{ /unless }}
{{ /collection:blog }}

Show entries based on a hardcoded list of terms (rel_terms="bacon|whiskey|…")

{{ collection:blog slug:isnt="{slug}" filter="Related" rel_taxonomy="tags" rel_terms="bacon|whiskey|burger" as="items"}}
{{ unless no_results }}
    <section class="related">
        <h2>Related</h2>
        {{ items }}
            {{ partial:blog/item }}
        {{ /items }}
    </section>
{{ /unless }}
{{ /collection:blog }}

Hint: Use the slug:isnt="{slug}" condition to filter out the current post.

Attributes

Those attributes are available on the collection tag.

Attribute Description
rel_taxonomy The name of the taxonomy field in the fieldset to compare against
rel_terms The list of terms to use

Important Links
Details
Released March 19, 2018
Downloads 344

Apps with love

We create Statamic things and things with Statamic!

More by Apps with love