{{.Site.BaseURL}} appears in a JS template literal

Hello,

I am new to hugo and trying to run the hugo site locally. My hugo version is:
119

While running, I get the following error:
{{.Site.BaseURL}} appears in a JS template literal

in line:
<a href="#"><img src="{{ .Site.BaseURL }}images/logo.png" class="logo"></a>

Thank you!

Could you please share your public test repo for reproducing the issue?

Thanks! here is the repo GitHub - okfn/network: Main repository for the Open Knowledge Network.

There is never a great reason to call .Site.BaseURL from a template. Hopefully we will deprecate that method at some point. Use the absURL and absLangURL functions instead.

Regarding the security notice, you can bypass Go’s protections by placing this in your site configuration:

[security.gotemplates]
allowActionJSTmpl = true
1 Like

Thank you!