Hi there,
I tried to use var langUser = '{{ .Site.languageUser := "en" }}';
in an html (template) file, and it’s not working.
Would you have any idea ?
Here is the error: error calling partial: Partial “js.html” not found
That is not the way to set a variable in Hugo. See the Docs.
Also the missing partial error is irrelevant to the variable.
That message means that Hugo is looking for /layouts/partials/js.html and it cannot find it. Somewhere in your templates there is a call for this partial and apparently it’s missing.
I know this is an old thread, but in modern hugo version, it is quite easy to do it. And as it took me some time to find the solution even with the forum, hope this helps others.
put your javascript with the needed {{ $variables }} in assets/js for example