For in with where filter no longer functioning correctly in Jekyll 4.0


I recently converted my project from Jekyll 3.7 to 4.0 and ran into a huge road block that I have not been able to work through.

The problem lies within the variable assignment and the where filter. On each iteration of the main for in loop, I build a new array (myItems). For some reason, in Jekyll 4, this does not work. The Array is empty on both iterations (first 10, then 11). The value on nav_actual is either 10 or 11. Again, working fine in 3.7, but not 4.0. Any ideas on how to get this working in 4.0? I’m stumped.

{% for i in (10…11) %}
{% assign myItems = site.linux | where: “nav_actual”, {{i}} %}

	<div class="column">
		{% if i == 11 %}
		{% endif %}
		<ul data-nav-d="{{i}}">
			{% for item in myItems %}
			{% if item.nav_actual == {{i}} %}
				<a class="desktopNavBtn" href="{{ item.url | append:' ' | replace:'/ ','' }}"><span>{{item.nav_label}}</span></a>
			{% endif %}
			{% endfor %}

	{% endfor %}

Sample Front Matter in the Linux Collection:

title: &title All Linux Learning Snippets
headline: Linux Snippets
permalink: /linux/snippets/
nav_label: Linux Snippets
nav_actual: 10

Help Appreciated

Hi Community,

I could still use your help with this and was hoping a repo would demonstrate the issue that I am having. Thanks for taking a moment to review.

@vsiege Unfortunately, the repo doesn’t help.
There is no linux collection in the repo. (Your for loop iterates through site.linux…)

Apologies. I have now added it to the repo. Please pull again. I have cleaned up the repo a great deal. Thanks for your help!

Okay, I was able to understand the problem better now.
The issue has been fixed on master branch of the Jekyll repository. You can edit your Gemfile to use the bleeding-edge version directly:

gem 'jekyll', github: 'jekyll/jekyll'

We may include the change in a v4.0.1… (can’t be certain) but it will definitely be included in a v4.1 when it ships.