CollectionBuilder / collectionbuilder-gh

A framework for creating digital exhibits from a folder of files and a spreadsheet. See Readme below for instructions to get started!
https://collectionbuilder.github.io/collectionbuilder-gh/
MIT License
92 stars 75 forks source link

Liquid error on GH Pages caused by `where_exp` #80

Closed wragge closed 3 months ago

wragge commented 3 months ago

If you set timeline-child-objects: false in theme.yml you get a Liquid error on GH Pages:

Liquid Exception: Liquid syntax error (/github/workspace/_includes/index/time.html line 4): Expected end_of_string but found id included in /_layouts/home-infographic.html

This seems to be because the version of Jekyll running on GH Pages doesn't support complex where_exp filters. (see https://github.com/jekyll/jekyll/issues/8046)

In _includes/index/time.html, the problematic line is:

{%- assign date-items = site.data[site.metadata] | where_exp: 'item','item.parentid == nil and item.objectid != nil' -%}

Note the and in the where_exp.

Getting rid of the and by breaking it up into two filters fixes the problem:

{%- assign date-items = site.data[site.metadata] | where_exp: 'item','item.parentid == nil' -%}
{%- assign date-items = date-items | where_exp: 'item','item.objectid != nil' -%}

Though perhaps there's a nicer way of doing this.

evanwill commented 3 months ago

Thanks @wragge! Yeah, the build in gh-pages jekyll version doesn't support and in the where_exp. CB-CSV uses lots of and, so we have to remove them all when transferring stuff into CB-GH. We must of missed this one... You are correct on the fix, we usually just string the two expressions together like: {%- assign date-items = site.data[site.metadata] | where_exp: 'item', 'item.objectid' | where_exp: 'item','item.parentid == nil' -%}

I pushed the fix! Thank you