Skip to main content

filters/tags

Joins the list of tags’ names in to a single string.

{{ post.tags|tags }}

Arguments

Name Type Default Description
separator str ', ' The separator between each tag.
last_separator str '' The separator between the last two tags. If this is an empty string then separator is used.
prefix str '' The prefix to all the tags.
suffix str '' The suffix to all the tags.
autolink bool True Whether to include a link to the tags page.

Description

The tags filter makes it easy to output a list of tags for a particular post or those used as a filter on a posts list page. The default arguments produce a comma-separated list including links to each tag page but the separators can be customised and the list can be prefixed and suffixed.

Examples

Default Arguments

Input

{{ post.tags|tags }}

Output

<a href="/tags/coffee">Coffee</a>, <a href="/tags/grinder">Grinder</a>, <a href="/tags/review">Review</a>

Non-Default Arguments

Input

{{ post.tags|tags(last_separator=' and ', prefix='Tagged: ', suffix='.', autolink=False) }}

Output

Tagged: Coffee, Grinder and Review.