Skip to content

How can i javascript in mustasche

I want to use javascript inside the mustache template. (test.mustache)

let query =;

I got ?lang=en with the above code.

<a href="{{link}}" class="ui label-lsc" style="background-color: {{wpsc_cat_bg_color}}; color: {{wpsc_cat_color}};">{{{value}}}</a>

i in this code I want to append ?lang=en after {{link}}.

Is there any way?


No, you can’t use JavaScript in your template.

The entire point of the template is to allow code to be extracted. Whatever code is currently executing your template is feeding the template a link variable, which the template is outputting via {{link}}. You need to modify that calling code so that it alters the value of link before it’s passed to the template.