Squarespace – 有没有办法只显示存档块中的特定类别?

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

试图在 Squarespace 存档块中只显示一个类别的内容。这是特定于主题的问题还是我可以通过代码注入实现此目的的方法?

这不是 template/theme-specific 问题。这是 Archive Block 在整个 Squarespace 平台上的限制(无论模板如何)。

可能的解决方法包括:

  1. 改用Summary Block
  2. 使用 CSS 隐藏与所需类别不匹配的存档块组。


解决方法 1

如果改为使用摘要块,请将布局设置为 "Grid",降低 "Gutter Width" 并根据需要调整其他设置。在 "Display" 下,根据需要增加项目数(最多 30 个),选中 "Show Title",取消选中其他内容选项,并将 "Category Filter" 设置设置为所需类别。


解决方法 2

如果您需要使用存档块而摘要块将不起作用,请通过 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 插入以下 CSS 以查找块 ID(但要查找下面显示的模式;不要使用以 "yui" 开头的 ID,因为它们是动态生成的并且会更改。

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

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