Tag template
Render blog-scoped post archives for one or more tags
templates/tags.liquid renders published posts that match tags in the route. This is a dedicated classic-theme route; Website Builder sites handle the route separately.
Routes
/blogs/:blogSlug/tags/:tag
/blogs/:blogSlug/tags/:tag+another-tagMultiple tags use AND matching: a post must have every requested tag. The route always selects templates/tags.liquid; it does not select named variants.
Context
The template receives tags, posts, and the normal template globals.
tags
An array of tag slugs taken from the URL. These are strings, unlike the tag relationship objects available on a post.
posts
The route returns at most 100 published posts. Each entry is a route-specific summary with id, title, slug, description, image, publishDate, and tags. It does not include the full post template context.
Example
Remove the active language prefix before reading the blog slug from request.path; this keeps generated links correct on translated routes.
{% layout 'layouts/default.liquid' %}
{% capture content_for_layout %}
{% assign route_path = request.path | remove_first: locale_prefix %}
{% assign route_parts = route_path | split: '/' %}
{% assign blog_slug = route_parts[2] %}
<main class="tags-page">
<header>
<h1>Posts tagged {{ tags | join: ', ' }}</h1>
<p>{{ posts.size }} {% if posts.size == 1 %}result{% else %}results{% endif %}</p>
</header>
{% if posts.size > 0 %}
<ul class="post-list">
{% for post in posts %}
<li>
<article>
{% if post.image %}
<img
src="{{ post.image | image_url: width: 480, height: 300, fit: 'cover' }}"
alt="{{ post.image.alt | default: post.title }}"
loading="lazy"
>
{% endif %}
<h2>
<a href="{{ locale_prefix }}/blogs/{{ blog_slug }}/posts/{{ post.slug }}">
{{ post.title }}
</a>
</h2>
{% if post.publishDate %}
<time datetime="{{ post.publishDate }}">{{ post.publishDate | date: '%d %B %Y' }}</time>
{% endif %}
{% if post.description %}<p>{{ post.description }}</p>{% endif %}
{% if post.tags.size > 0 %}
<ul aria-label="Tags">
{% for tag in post.tags %}
<li>
<a href="{{ locale_prefix }}/blogs/{{ blog_slug }}/tags/{{ tag.slug }}">
{{ tag.title }}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
</article>
</li>
{% endfor %}
</ul>
{% else %}
<p>No posts match all of these tags.</p>
{% endif %}
</main>
{% endcapture %}
{% schema %}
{
"settings": []
}
{% endschema %}Link to tags
Post relationships contain tag objects. Join tag slugs with + only when you intentionally want an AND filter.
{% for tag in post.tags %}
<a href="{{ locale_prefix }}/blogs/{{ post.blog.slug }}/tags/{{ tag.slug }}">
{{ tag.title }}
</a>
{% endfor %}
<a href="{{ locale_prefix }}/blogs/{{ post.blog.slug }}/tags/interview+behind-the-scenes">
Posts with both tags
</a>