Entries are filtered by overlapping/intersecting terms.
Copy the Related
folder to your site/addons
folder
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.
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 |