-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
incorrect escaping #10707
Comments
This seems like a bug (due to inconsistent output when comparing lines 2 and 3) in Go's html/template package. If I switch to using Go's text/template package with...
... I get the expected results:
With the default output configuration (using Go's html/template package), if I pass the entire string through
|
I (think) this should test it in Go: https://go.dev/play/p/uHRYjxnzIaI?v=goprev But that gives me:
Which I also assume is not correct. |
OK, revisiting this with: https://go.dev/play/p/Nl4_5-ynidw?v=goprev Wrapping it in |
Do you want me to log an issue upstream? |
Yes, that would be good (I suspect they're a little tired of my issue "spamming"). |
The original issue was opened on Dec 3, 2014. |
This is a known go bug with no easy solution |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What version of Hugo are you using (
hugo version
)?The stock package on Debian bookworm:
Does this issue reproduce with the latest release?
Yes, this is the latest release.
Problem description
I configure a global parameter
baseURL = "/"
, and request it to be inserted as known-safe JavaScript (https://gohugo.io/functions/safejs/) within some backtick-delimited JavaScript strings inside a<script>
tag.In certain cases the slash is incorrectly escaped.
Minimal example
Extract minimal.zip in
/tmp/minimal
, launchhugo
, then look atpublic/index.html
:based on the
layouts/shortcodes/home_map.html
shortcode:I'd have expected this output:
but the slash in the second string is escaped. If you remove the
<
line from the first string, all urls are correctly unescaped.Something weird is going on!
The text was updated successfully, but these errors were encountered: