Expected end_of_string but found id

I hope somebody can help me, I have been battling this problem for a couple of hours now.

First some background: I was using github pages for my user page, the supported versions of Jekyll is listed at https://pages.github.com/versions/. My user page was using an unmaintained template thus I decide to create a new Jekyll site and build the layout from scratch. Everything works great on my local machine, but on my final push to github I received build failures - so after configuring Travis to build my site I saw this error:

Bundler could not find compatible versions for gem "jekyll"

That is when I discovered that gh-pages does not support the latest version of Jekyll, which I was building my site on - v4.0.0. So I regressed my Gemfile to the supported version of 3.8.5 and started getting this build error, both on gh-pages and on my local:

   Jekyll Feed: Generating feed for posts
  Liquid Exception: Liquid syntax error (line 1): Expected end_of_string but found id in /_layouts/changelog.html
jekyll 3.8.5 | Error:  Liquid syntax error (line 1): Expected end_of_string but found id

the source file causing this, changelog.html is

layout: default
{% assign project_page = site.pages | where_exp:"n", "n.layout=='project' and n.title==page.project" | first %}

So by this point I am really frustrated and spent half the day on what should be a trivial issue.

This code worked before, I cannot grasp why this broke. Please somebody guide me in any direction, I am at my wit’s end.

I believe support for the and operator was added to the where_exp filter in Jekyll 4.0.0, which would explain why it worked locally but not on Github Pages. As a workaround, I believe you can split the two where_exp expressions and chain them together.

I’m not entirely sure of the exact syntax, but it would be something along the lines of:
{% assign project_page = site.pages | where_exp: "n", "n.layout == 'project'" | where_exp: "n", "n.title == page.project" | first %}

In case you weren’t aware of it, I also might recommend using the github-pages gem to ensure your local environment matches Github Pages. So your Gemfile would be:

source "https://rubygems.org"

gem "github-pages", group: :jekyll_plugins


Good luck!

1 Like

Thank you @ckruse, that was exactly the issue. I was referencing the liquid API documentation which targeted the newer version. I have included the github-pages gem as suggested which helped a great deal to debug and test. Thanks again!

1 Like