Search code examples
jekyllliquid

Jekyll, Liquid: using `default: "...", allow_false: true` throws an error


In Jekyll I'm trying to use the default filter, but allowing it to be false. In the documentation it says you can use the allow_false: true parameter. However, when I use this, the Jekyll output shows and error:

Liquid error (.../_includes/room_header.html line 7): wrong number of arguments (given 3, expected 1..2) included  (Liquid::ArgumentError)

That line is:

{% assign showNameToggle = include.showNameToggle | default: true, allow_false: true %}

I tried the (almost) exact line from the documentation, but same error:

{{ include.name | default: "No Name", allow_false: true }}

Why does this happen?

Thanks!


Solution

  • The commit you're referring to has not been released yet.

    It was committed on Oct 8, 2019.
    The latest version was released on March 12, 2019.

    To use unreleased code, you can point your Gemfile to the repository:

    # Gemfile
    
    # Use code from the default branch (`master`) of the GitHub repository
    gem 'liquid', github: 'Shopify/liquid'
    

    CAUTION! Use unreleased code at your own risk. It is generally unstable and may result in unexpected results.