Skip to content

Commit

Permalink
Replace "hidden" check in Liquid with where_exp
Browse files Browse the repository at this point in the history
  • Loading branch information
iBug committed May 4, 2024
1 parent bde92b6 commit 6165d89
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions _includes/documents-collection.html
Original file line number Diff line number Diff line change
@@ -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 %}
Expand All @@ -9,7 +9,5 @@
{% endif %}

{%- for post in entries -%}
{%- unless post.hidden -%}
{% include archive-single.html %}
{%- endunless -%}
{% include archive-single.html %}
{%- endfor -%}
8 changes: 2 additions & 6 deletions _includes/page__related.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{% assign posts = include.posts | where_exp: "post", "post.hidden != true" %}
<div class="page__related">
{% include before-related.html %}
<h2 class="page__related-title">{{ site.data.ui-text[site.locale].related_label | default: "You May Also Enjoy" }}</h2>
<div class="grid__wrapper">
{% 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 %}
</div>
Expand Down
7 changes: 3 additions & 4 deletions _includes/posts-category.html
Original file line number Diff line number Diff line change
@@ -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 -%}
7 changes: 3 additions & 4 deletions _includes/posts-tag.html
Original file line number Diff line number Diff line change
@@ -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 -%}
3 changes: 2 additions & 1 deletion docs/_docs/18-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
---

Expand All @@ -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

Expand Down
7 changes: 3 additions & 4 deletions docs/_pages/page-archive.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
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 %}

0 comments on commit 6165d89

Please sign in to comment.