[Solved] .Site.BaseURL Is Escaped?

Hi all.

I’m building a simple site. My config.toml contains a baseURL that looks like the following:

baseURL = "https://developer.okta.com"

Unfortunately, when I try to use that URL in a template via:

<script>
  var searchDomain = "{{ .Site.BaseURL }}";
</script>

The code ends up being rendered as:

<script>
  var searchDomain = "https:\/\/developer.okta.com";
</script>

Which doesn’t work for my use case – I need the exact string. I tried using the safeURL function, eg: {{ .Site.BaseURL | safeURL }}, but that doesn’t solve the problem.

What am I missing here?

remove the double-quotes "

2 Likes

Thank you! That solved it… Can’t believe I didn’t try that before.