Define Liquid custom function #11468
Answered
by
ns8482e
DotCat1985
asked this question in
Q&A
-
Hi, |
Beta Was this translation helpful? Give feedback.
Answered by
ns8482e
Mar 31, 2022
Replies: 1 comment 1 reply
-
In OC You can extend liquid options by adding template options in module startup services.Configure<TemplateOptions>(o =>
{
var lowercase = new FunctionValue((args, context) =>
{
var firstArg = args.At(0).ToStringValue();
var lower = firstArg.ToLowerCase();
return new ValueTask<FluidValue>(new StringValue(lower));
});
o.Scope.SetValue("lowercase”, lowercase);
}); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
DotCat1985
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In OC You can extend liquid options by adding template options in module startup