This function allows you to display a list of channel entries that contain the tag(s) in the URL, or in the tag parameter. This template is usually a page you would link to from a Tag Cloud or through an entry with the Tag:Tags function.

By default, the Tag:Entries function looks in the URI for tag(s). It knows where to find them by checking for a marker/trigger in the URI by the name of tag. This can be adjusted to be a different value by using the marker parameter. So a typical URL would look like this: http://www.site.com/articles/by_tag/tag/pants/

If you prefer not to have the additional segment in your URI, you can name your actual template as tag instead, and then not add the additional marker/trigger segment in the URI as mentioned above. Your resulting URL would look something like this: http://www.site.com/articles/tag/pants/

{exp:tag:entries} content {/exp:tag:entries} 

Parameters

Most of the parameters available in the Channel:Entries loop are available here. Additionally, these exist as well:

channel_entry_id=

channel_entry_id="not 7|16|46" 

This parameter behaves exactly like the the regular EE entry_id parameter. This allows you to filter out or filter down to specific channel entries.

exclusive=

exclusive="yes" 

By default, if you specify not apples in the tag parameter of the Tag:Entries loop, all entries that have that tag would not show up in the list. However, if the entry has any other tag(s) assigned to it, it would still show up in the results because of matches on the other tags. This follows native EE behaviour with the Channel:Entries loop and Categories. If you would like to change the behavior to not show entries that have ANY tag(s) that match the specified (not apples), then use the exclusive parameter set to yes. This means that if Entry A has apples, oranges, and pie assigned to it, and if you have tag="not apples" and exclusive="yes" parameters specified, Entry A will no longer show up in the list of results.

id_marker=

id_marker="whatever" 

If you're using tag ID's in the URI instead of tag names, this parameter tells Tag:Entries which marker to look for in your URL to determine for which tag(s) to show entries for. If you don't provide this parameter, Tag will parse the URL on the marker tag/ID, like this: http://www.solspace.com/template_group/template/tag/id/27/

inclusive=

inclusive="yes" 

You can pull entries by multiple tags when tags are separated by commas in the URI. If you set this parameter to yes, only entries that contain all of the tags will be shown. Otherwise, the default method just checks to see if any of the tags match.

marker=

marker="department" 

It's possible to change the marker in the URI from the default of tag, to something of your choice. This parameter tells Tag:Entries which marker to look for in your URI. By default, Tag will check the URI for the marker tag, like this: http://www.site.com/articles/by_tag/tag/pants/

paginate=

paginate="both" 

This parameter allows you to control where the pagination will display. Options are top, bottom, or both. Used in conjunction with the tag_paginate variable pair.

tag=

tag="pretzels" 

This parameter allows you to hardcode a tag in which to pull entries that match. Otherwise, the tag is normally dynamically supplied in the URI. To specify multiple tags, separate tags with the pipe character. To exclude any tags, you can preceed the tags with not. If using not, you will likely want to call the exclusive parameter as well.

tag_group_id=

tag_group_id="3" 

This parameter allows you to narrow down or filter the tag results in the list by specifying the tag group ID. Seperate multiples with the pipe character.

tag_group_name=

tag_group_name="group1|group2" 

This parameter allows you to narrow down or filter the tag results in the list by specifying the tag group short name. Seperate multiples with the pipe character.

tag_separator=

tag_separator="_" 

This parameter allows you to specify the character that separates multiple tags in the URI, in the event you're calling multiple tags in the URI. Default is comma (,), but if your site is set to force query strings, EE won't let you have commas in the URI.

websafe_separator=

websafe_separator="-" 

This parameter allows you to control the websafe separator character for multi-word tags in the URI. Allowable characters are +, -, and _. The default is +. Be sure to use this parameter consistently throughout your site if you change from the default value of +. For example, if you're linking from your Tag cloud to your Tag:Entries page with - as your websafe separator, you'll need to add this same parameter with - as the value for your Tag:Entries page. Otherwise results will NOT show correctly.

Variables

Most of the variables available in the Channel:Entries loop are available here.

Variable Pairs

Most of the variable pairs available in the Channel:Entries loop are available here. Additionally, the following variable pairs are available for use:

tag_paginate

{tag_paginate}
    Page {tag_current_page}
    of {tag_total_pages} pages
      {tag_pagination_links}
{/tag_paginate}

Pagination is available for this tag and works just like regular EE pagination, but each variable/variable pair is prepended with tag_ (except for any variables/variable pairs inside of the tag_pagination_links variable pair). Used in conjunction with the paginate parameter.

Conditionals

Most of the conditionals available in the Channel:Entries loop are available here.

Examples

The below example will display the title and body of all channel entries associated with the specified tag. Additionally, it will pull the tag name from the URI and “clean it up” using the Tag:Name function.

Entries tagged with: {exp:tag:tag_name}

{exp:tag:entries
    inclusive="yes"
    orderby="entry_date"
    sort="asc"
    limit="20"
    paginate="bottom"
}

    <h2>{title}</h2>
    <p>{body}</p>

{tag_paginate}
    <p>Page {tag_current_page} of {tag_total_pages}. {tag_pagination_links}</p>
{/tag_paginate}

{/exp:tag:entries}