Template Docs Commerce APIs Tools
Get Started
Get Started

Category Tag

Category Tags in Squarespace are a way to dynamically display the categories from the collection being viewed. Handy for a Blog or Events collection and can assist in navigating large collections.

Similar to a Navigation Tag, you can bind the category information to a template (.block file) to create the markup of the categories (when you do, the tag should be self-closed). Although, the template attribute is optional, a Squarespace Category Tag requires the collection attribute be populated with the collection url ID as shown in this example:

<squarespace:category collection="{urlId}" template="category-slugs" />

As an alternative, you can omit the template and just create the markup inline by using a non-self-closing version of the Squarepace Category tag and putting your markup inside as shown in this fine example:

{.section collection}
  <squarespace:category collection="{urlId}">
    {.if categories}
      <div class="category-wrapper">
        <span class="category">{.repeated section categories}{name}{.alternates with}, {.end}</span>

A Category Tag can also be a great way to 'filter' large galleries of work and can be used in either a .region or .list file.