Closed BjornDCode closed 3 years ago
@BjornDCode use the option strictMode
with value false
to suppress mistakes
@Scrum this still throws a ReferenceError
:
<if condition="key_not_exists">
{{ key_not_exists.foo }}
it works!
</if>
Result:
Rejected promise returned by test. Reason:
ReferenceError {
message: 'key_not_exists is not defined',
}
Originally reported in maizzle/framework#354
Hi have you used this parameter? https://github.com/posthtml/posthtml-expressions/issues/102#issuecomment-719518146
I was using it, yes. It works in 1.6.1
now, thanks!
Problem
It's not currently possible to have a conditional that checks whether a key is set in the
locals
object.This is an expansion to #79
Details
I have a use case where the contents of the
locals
object is dynamic. It's read from front-matter from a markdown file. I would like to be able to check whether the key is set in the locals object and then output the value if it does.Front matter:
Which is parsed into the following object:
If I for example don't include
category
in the front-matter then the object would look like the following:In the HTML template it's not currently possible to check whether
category
exists:It throws the following error:
I've tried the following as well:
Which throws the same error as in #101
Error Logs
The full error: