Category template
Render the blog-scoped archive for one post category
templates/category.liquid renders the published posts in one category. This is a dedicated classic-theme route; Website Builder sites handle the route separately.
Route
/blogs/:blogSlug/categories/:slugFor example, /blogs/news/categories/reviews renders templates/category.liquid. The route does not select named template variants.
Context
The template receives category, posts, and the normal template globals.
category
| Property | Type | Description |
|---|---|---|
id | string | Category ID |
title | string | Category name |
slug | string | Category slug |
image | media | Category image, when configured |
blog | string | Related blog ID |
posts
The route returns at most 100 published posts. Each entry is a route-specific summary with id, title, slug, description, image, publishDate, and categories. 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="category-page">
<header>
<h1>{{ category.title }}</h1>
<p>{{ posts.size }} {% if posts.size == 1 %}post{% else %}posts{% 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 %}
</article>
</li>
{% endfor %}
</ul>
{% else %}
<p>No posts in this category yet.</p>
{% endif %}
</main>
{% endcapture %}
{% schema %}
{
"settings": []
}
{% endschema %}Link to a category
Post relationships include category records and the related blog. Use those slugs rather than handleize:
{% for category in post.categories %}
<a href="{{ locale_prefix }}/blogs/{{ post.blog.slug }}/categories/{{ category.slug }}">
{{ category.title }}
</a>
{% endfor %}