Search code examples
blogssquarespace

Squarespace – Is there a way to only show a specific category in the Archive Block?


Trying to only display one category content in the Squarespace Archive Block. Is this a theme specific issue or a way I can achieve this maybe with a code injection?

enter image description here


Solution

  • That is not a template/theme-specific issue. That is a limitation of the Archive Block across the entire Squarespace platform (no matter the template).

    Possible workarounds include:

    1. Use the Summary Block instead.
    2. Use CSS to hide archive block groups that do not match the desired category.


    Workaround 1

    If using a Summary Block instead, set the Layout to "Grid", lower the "Gutter Width" and adjust other settings as desired. Under "Display", raise the number of items as desired (max of 30), check "Show Title", uncheck other content options, and set the "Category Filter" setting to the desired category.

    enter image description here


    Workaround 2

    If you need to use the Archive Block and the Summary Block will not work, inserting the following CSS via the CSS Editor will hide lists of items that do not match the desired category. Note that you must swap out your target block ID and category for "yourblockid" and "Your Category" respectively. You can use your browser developer tools to find the block ID (but look for the pattern shown below; do not use IDs starting with "yui", since those are dynamically generated and will change).

    #block-yourblockid .archive-group-name-link:not([href$='Your Category']) {
      display: none;
    }
    
    #block-yourblockid .archive-group-name-link:not([href$='Your Category']) + * {
      display: none;
    }