diff --git a/CHANGELOG.md b/CHANGELOG.md
index 82b0dee3..0ad7de1f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@
- Add support for [Jekyll Paginate V2](https://github.com/sverrirs/jekyll-paginate-v2) 🎉 [#2636](https://github.com/mmistakes/minimal-mistakes/pull/2636)
- Auto scroll sticky ToC with content. [#3115](https://github.com/mmistakes/minimal-mistakes/pull/3115)
+- Replace "hidden" check in Liquid templates with `where_exp: "item", "item.hidden != true"`.
### Documentation & Maintenance
diff --git a/_includes/documents-collection.html b/_includes/documents-collection.html
index e88d8c4c..bb19bfb6 100644
--- a/_includes/documents-collection.html
+++ b/_includes/documents-collection.html
@@ -1,4 +1,4 @@
-{% assign entries = site[include.collection] %}
+{% assign entries = site[include.collection] | where_exp: "post", "post.hidden != true" %}
{% if include.sort_by %}
{% assign entries = entries | sort: include.sort_by %}
@@ -9,7 +9,5 @@
{% endif %}
{%- for post in entries -%}
- {%- unless post.hidden -%}
- {% include archive-single.html %}
- {%- endunless -%}
+ {% include archive-single.html %}
{%- endfor -%}
diff --git a/_includes/page__related.html b/_includes/page__related.html
index 1b655d6d..9777865e 100644
--- a/_includes/page__related.html
+++ b/_includes/page__related.html
@@ -1,14 +1,10 @@
+{% assign posts = include.posts | where_exp: "post", "post.hidden != true" %}
{% include before-related.html %}
{{ site.data.ui-text[site.locale].related_label | default: "You May Also Enjoy" }}
- {% assign count = 0 %}
- {% assign limit = include.limit | default: 4 %}
- {% for post in include.posts %}
- {% if post.hidden %}{% continue %}{% endif %}
+ {% for post in posts limit:4 %}
{% if post.id == page.id %}{% continue %}{% endif %}
- {% if count >= limit %}{% break %}{% endif %}
- {% assign count = count | plus: 1 %}
{% include archive-single.html type="grid" %}
{% endfor %}
diff --git a/_includes/posts-category.html b/_includes/posts-category.html
index b364f30e..658f3151 100644
--- a/_includes/posts-category.html
+++ b/_includes/posts-category.html
@@ -1,5 +1,4 @@
-{%- for post in site.categories[include.taxonomy] -%}
- {%- unless post.hidden -%}
- {% include archive-single.html %}
- {%- endunless -%}
+{% assign posts = site.categories[include.taxonomy] | where_exp: "post", "post.hidden != true" %}
+{%- for post in posts -%}
+ {% include archive-single.html %}
{%- endfor -%}
diff --git a/_includes/posts-tag.html b/_includes/posts-tag.html
index 46fade02..a8fc472b 100644
--- a/_includes/posts-tag.html
+++ b/_includes/posts-tag.html
@@ -1,5 +1,4 @@
-{%- for post in site.tags[include.taxonomy] -%}
- {%- unless post.hidden -%}
- {% include archive-single.html %}
- {%- endunless -%}
+{% assign posts = site.tags[include.taxonomy] | where_exp: "post", "post.hidden != true" %}
+{%- for post in posts -%}
+ {% include archive-single.html %}
{%- endfor -%}
diff --git a/docs/_docs/18-history.md b/docs/_docs/18-history.md
index 14fed509..09726303 100644
--- a/docs/_docs/18-history.md
+++ b/docs/_docs/18-history.md
@@ -5,7 +5,7 @@ permalink: "/docs/history/"
excerpt: Change log of enhancements and bug fixes made to the theme.
sidebar:
nav: docs
-last_modified_at: '2024-05-05T02:36:12+08:00'
+last_modified_at: '2024-05-05T03:17:32+08:00'
toc: false
---
@@ -25,6 +25,7 @@ toc: false
- Add support for [Jekyll Paginate V2](https://github.com/sverrirs/jekyll-paginate-v2) 🎉 [#2636](https://github.com/mmistakes/minimal-mistakes/pull/2636)
- Auto scroll sticky ToC with content. [#3115](https://github.com/mmistakes/minimal-mistakes/pull/3115)
+- Replace "hidden" check in Liquid templates with `where_exp: "item", "item.hidden != true"`.
### Documentation & Maintenance
diff --git a/docs/_pages/page-archive.html b/docs/_pages/page-archive.html
index e2b3fdcb..ada3f64f 100644
--- a/docs/_pages/page-archive.html
+++ b/docs/_pages/page-archive.html
@@ -5,8 +5,7 @@ permalink: /page-archive/
author_profile: false
---
-{% for post in site.pages %}
- {% unless post.hidden %}
- {% include archive-single.html %}
- {% endunless %}
+{% assign posts = site.pages | where_exp: "post", "post.hidden != true" %}
+{% for post in posts %}
+ {% include archive-single.html %}
{% endfor %}