Oh, the joys of Go templates. This is one area where Go templates are often confusing or surprising. Thanks for the sample project. If you missed it, @rindolphus had the solution for you.
The issue revolves around Go template contexts. Go often doesn’t like inserting content into a value. It wants to create the entire value. In your case, Go wants to insert the entire JS string including the double-quotes, not just the stuff inside the quotes. Two ways to make this work:
Maybe I am missing something. My web site is still generating the escaped URL.
I have changed my code to match your suggestion, did a rm -fr public and then hugo. I have pushed the results back up to my github repository so you can see the public/index.html file.
Is it important to note that I am using the templating inside JSON+LD?
I have used URL processing in other parts of web sites without any issues. The only difference I can tell is that this is a HTML script element block containing JSON+LD.