Summary
Change gojekyll to accept {% assign page.property = value %} syntax with a warning instead of failing the build. This improves compatibility with Ruby Jekyll, which silently accepts this syntax.
Background
Testing with Ruby Jekyll 4.4.1 confirms that {% assign page.custom_var = "from-assign" %} is parsed without error but is effectively a no-op:
| Expression |
Ruby Jekyll Output |
{{ page.custom_var }} after {% assign page.custom_var = "from-assign" %} |
from-frontmatter (assign did NOT override) |
{{ page.new_var }} after {% assign page.new_var = "new-value" %} |
(empty) (assign did NOT make it accessible) |
The assign creates a variable under the literal key "page.custom_var" in the assigns hash, but {{ page.custom_var }} resolves via the page drop (page → .custom_var), a different lookup path.
Currently gojekyll errors: syntax error: dot notation in assign tag requires Jekyll extensions to be enabled. This breaks compatibility with Jekyll sites that use this syntax (see #60).
Proposed behavior
- Default mode: Accept the syntax, emit a warning: "
{% assign page.custom_var = ... %} has no effect. In Jekyll, dot notation in assign creates an inaccessible variable."
- Future strict mode (
--strict): Upgrade warnings to errors
Dependencies
Depends on osteele/liquid#144 — adding warnings support to liquid's render output. Once liquid can return warnings alongside rendered output, gojekyll can:
- Collect warnings from all page renders
- Print them to stderr
- Optionally fail the build in strict mode
Related
Summary
Change gojekyll to accept
{% assign page.property = value %}syntax with a warning instead of failing the build. This improves compatibility with Ruby Jekyll, which silently accepts this syntax.Background
Testing with Ruby Jekyll 4.4.1 confirms that
{% assign page.custom_var = "from-assign" %}is parsed without error but is effectively a no-op:{{ page.custom_var }}after{% assign page.custom_var = "from-assign" %}from-frontmatter(assign did NOT override){{ page.new_var }}after{% assign page.new_var = "new-value" %}The assign creates a variable under the literal key
"page.custom_var"in the assigns hash, but{{ page.custom_var }}resolves via the page drop (page→.custom_var), a different lookup path.Currently gojekyll errors:
syntax error: dot notation in assign tag requires Jekyll extensions to be enabled. This breaks compatibility with Jekyll sites that use this syntax (see #60).Proposed behavior
{% assign page.custom_var = ... %}has no effect. In Jekyll, dot notation in assign creates an inaccessible variable."--strict): Upgrade warnings to errorsDependencies
Depends on osteele/liquid#144 — adding warnings support to liquid's render output. Once liquid can return warnings alongside rendered output, gojekyll can:
Related
EnableJekyllExtensions()(to be superseded)