If your GitHub Pages code contains invalid syntax in the Liquid for loop declaration, your GitHub Pages site will not be built.

If your GitHub Pages site fails to build because of invalid syntax in the Liquid for loop declaration, you'll get an email that looks like this:

Subject: Page build failed

The page build failed with the following error:

There is a syntax error in the 'for' loop in index.html. Valid syntax is 'for <item> in <collection>', and the <item> variable may not contain hyphens or quotation marks.

Troubleshooting 'for' loop syntax errors

Tip: To debug and fix build errors before you push to GitHub, run Jekyll locally.

  • Check the tags in the referenced file. Ensure any for loops have the proper syntax. They should look something like:

    {% for item in array %}
      <!-- for loop body -->
    {% endfor %}
    

Once you've fixed any for loop errors, you will need to commit your changes and push to your GitHub Pages repository again to trigger another build on the server.