Default Support for Include Params
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 11.9k
- Forks
- 1.5k
- Avg merge
- 17h 55m
- Merged PRs (30d)
- 3
Description
I'd like to implement a coalesce-like workflow for my includes, like I can do in javascript with chaining multiple a || b together, such as var = include.var || page.var || site.var;. It'll reduce repetition in the codebase. The default operator seems to be erroring out when testing against a missing include param. Therfore, instead of:
{% assign odd = include.odd | default: false %}
I have to do:
{% assign odd = false %}{% if include.odd %}{% assign odd = include.odd %}{% endif %}
It would be good for the default filter to support include params. I got then do something like:
{% assign odd = include.odd | default: page.odd | default: site.odd | false %}
Although this example is a little contrived, I'm happy to provide a more real-world example.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the default filter implementation and the handling of missing include parameters in the Liquid codebase. Review existing filter tests and add coverage for defaulting a missing include parameter to a fallback value. Done means the shown include-based default workflow no longer errors and the behavior is covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100