The Shopify Liquid docs for the {% for %}
loop tag declare that:
for
loops can output a maximum of 50 results per page. In cases where there are more than 50 results, use thepaginate
tag to split them across multiple pages.
This question confirms that, as of four years ago, the 50-item limit was active in Shopify.
However, if I scratch together a Jekyll post with the content
as:
.{% for var in (1..100) %} {{ var }} .{% endfor %}
it renders in the build as I would expect, including all integers from one to one hundred:
So, clearly at least some for
loops in Jekyll aren't bound by this 50-item limit.
Is Jekyll completely free of this constraint? Or, are there some situations where for
loops will unexpectedly get truncated at 50 items?
No, Jekyll does not have this kind of limit.
for
loop in Jekyll is unlimited by default.You showed an example of a for
loop saying "some for
loops" are unlimited. I can't think of any other kind of for
loop, just maybe the ones which iterate a collection, like posts. So I created a Bash script which tests if Jekyll has that kind of limit. The script creates a new project, creates 1000 copies of the sample post, builds the site and counts the post links on the index page. (The index page of the default sample project lists all posts without pagination.) For me it returns 1000, which means Jekyll does not truncate the results at 50.
#!/bin/bash
N=1000
F=2018-08-14-welcome-to-jekyll
rm -rf limit-test
jekyll new limit-test
cd limit-test
for i in $(seq 2 $N); do
cp _posts/$F.markdown _posts/$F-$i.markdown
done
jekyll build
grep "post-link" _site/index.html | wc -l
# 1000