greenelab/lab-website-template

Issue building new release v1.0.0, Liquid syntax error

colquittlab opened this issue · 2 comments

Checks

Link to your website repo

https://github.com/colquittlab/colquittlab.github.io

Version of Lab Website Template you are using

1.0.0

Description

I've been troubleshooting a GitHub Pages build issue but am running up against a wall.

I've tested my site locally and it build correctly. But pushing to GitHub and subsequent build yields this error:

Liquid Exception: Liquid syntax error (/github/workspace/_includes/head.html line 22): Expected end_of_string but found id included in /_layouts/default.html

I think I have tracked this down to line 22 of _includes/styles.html:

{% assign styles = site.static_files
| where_exp: "file",
"file.path contains '/_styles' and file.path contains '.css'"
%}

It looks like 'and' operators are not supported in Jekyll <4.0 and GitHub pages appears to be using v3.9.3.

I edited this Liquid statement to:

{% assign styles = site.static_files
| where_exp: "file",
"file.path contains '/_styles'"
| where_exp: "file",
"file.path contains '.css'"
%}

But now receive this error:

Liquid Exception: Invalid scheme format: ' <div class="cols" style="--cols' in /_layouts/default.html

Thoughts? Thank you.

Try adding a single blank file named .nojekyll in the root of your gh-pages branch, and make sure GitHub Pages is set to build from the gh-pages branch. See the setup instructions in the new docs.

Without the .nojekyll file, GitHub Pages will attempt to run Jekyll on whatever you have in the selected branch, even if it's not Jekyll code. And the version of Jekyll it runs is an older, locked down (only these plugins are allowed) version of Jekyll, I guess 3.9.3.

The template v1.0.0 doesn't use GitHub's built-in, limited Jekyll. It uses the latest version 4.3, as you will see in your Gemfile, without any limitations, and builds it "explicitly" with GitHub Actions (.github/workflows/build-site.yaml) any time you push a change to your repo.

See that, in your commit to main, the template's GitHub Action was able to build the site fine, no syntax error. But your GitHub Pages deployment is failing, probably because it's still building directly from main and running the old Jekyll:

Screenshot 2023-03-15 at 7 00 32 PM

Normally the template creates the .nojekyll file for you when you set it up, but you wouldn't have run that first time set up if you were coming from an old version of the template. I'll think about how I need to update the docs to account for this.

Excellent, that fixed it! I had never run the first-time-setup Action (as I thought everything was setup from the previous version...), but running this solved it. Thanks for the help and the excellent template.