Tag 2.1 Related Entries

It sure can be convenient to be viewing a weblog entry and pull other entries related to it by virtue of shared tags. That's what this function is designed for.

Parameters

entry_id=

entry_id="{entry_id}"

Normally tag:related_entries will simply pull an entry id or url title from the URL then fetch entries related to the main entry by shared tags. If you like, you can force a primary entry by passing the entry id parameter. This gives you crazy web developers out there a lot more power.

exclude=

exclude="tacos|nachos|peanut"

The 'exclude' parameter allows you to exclude entries based on specified tags from showing up. For multiples, add pipe.

paginate=

paginate="bottom"

This parameter determines where the pagination code will appear for your Tag Related Entries. If no parameter is specified, the navigation block will default to the "bottom" behaviour. top: The navigation text and links will appear above your list of entries. bottom: The navigation text and links will appear below your list of entries. both: The navigation text and links will appear both above and below your list of entries.

rank_limit=

rank_limit="5"

Every tag on your site has at least one entry assigned to it. Some tags are used by more entries than others. As such, there is a ranking of tags. This parameter ranks the tags that belong to the primary entry of the page. It chooses the top ranked of those tags, limiting that selection by the number you provide in the parameter. Then pulls related entries that have those top ranked tags in common with the primary entry of the page.

This parameter is designed to filter out the clutter. There may be many many entries related to your primary entry by virtue of all the shared tags, but you don't want to show them all. You may want a filtered list of entries based on sharing the highest ranked tags.

But it gets better, tags can be ranked in one of three ways. Tags can be ranked by how often they are used, by how often they are clicked or both. See the 'rank_method' parameter below.

Important: Using this parameter, you are only limiting the number of related entries by those of a certain tag rank. The entries are not ordered by rank. Rather, they are ordered by standard weblog:entries ordering preferences.

rank_method=

rank_method="clicks|total_entries"

The Tag module ranks tags. A tag can be ranked by how often it is clicked on the site, by how many entries use it, or both. You can show related entries by tag rank and you can establish the ranking method using this parameter. Allowed values are 'clicks' and 'total_entries'. You can indicate both by joining the two with a pipe '|'.

Variables

All of the variables available in the weblog:entries tag are available here. Be careful of variable collisions between this function and the weblog:entries function if you decide to call this function inside a weblog:entries tag pair. If you need to do something nutty like this, put your related entries code in a separate template and embed it inside your weblog:entries tag.

Variable Pairs

All of the variable pairs available in the weblog:entries tag are available here.

Conditionals

All of the conditionals available in the weblog:entries tag are available here.

Examples

Below is a basic example of using the Related Entries loop ouside of the Weblog:Entries loop on a single entry view template.

{exp:tag:related_entries weblog="your_weblog" orderby="date" sort="desc" dynamic="off" limit="5" paginate="bottom"}
<p><a href="{permalink="template_group/template"}">{title}</a></p>
<p>{summary}</p>
<p>{custom_field}</p>
<br /><br />
<p>{paginate}{pagination_links}{/paginate}</p>
{/exp:tag:related_entries}