Skip to content
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

safeHTML marked HTML data elements (.Site.Data, JSON etc.) are escaped #3876

Closed
Brixy opened this issue Sep 11, 2017 · 12 comments · Fixed by #3880
Closed

safeHTML marked HTML data elements (.Site.Data, JSON etc.) are escaped #3876

Brixy opened this issue Sep 11, 2017 · 12 comments · Fixed by #3880
Assignees
Milestone

Comments

@Brixy
Copy link

Brixy commented Sep 11, 2017

Thanks for v0.27. Related content is great and fast.

Just want to mention that (some?) shortcodes suddenly escape html. The instagram expample from the website results in:

<blockquote class="instagram-media" data-instgrm-captioned data-instgrm-version="7" style=" background:#FFF; border:0; border-radius:3px; box-shadow:0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width:658px; padding:0; width:99.375%; width:-webkit-calc(100% - 2px); width:calc(100% - 2px);"><div style="padding:8px;"> <div style=" background:#F8F8F8; line-height:0; margin-top:40px; padding:33.251231527093594% 0; text-align:center; width:100%;"> <div style="

…

Also my own shortcodes are escaped.

Thank you.

@bep
Copy link
Member

bep commented Sep 11, 2017

Hmm... Probably a Go 1.9 thing. But gohugo.io is built with Hugo 0.27 and I don't see any issue there:

https://gohugo.io/content-management/shortcodes/#instagram

@bep
Copy link
Member

bep commented Sep 11, 2017

What OS are you running?

@digitalcraftsman can you reproduce this?

@Brixy
Copy link
Author

Brixy commented Sep 11, 2017

macOS 10.12.6

Thanks for your help, @bep. I guess, your middle name is “fast”, too!

@bep
Copy link
Member

bep commented Sep 11, 2017

Thanks for your help, @bep. I guess, your middle name is “fast”, too!

No, that is my last name. My middle name is Erik :-)

@digitalcraftsman
Copy link
Member

I compiled the latest version and checked the docs locally. But I wasn't able to reproduce this issue either.

@Brixy
Copy link
Author

Brixy commented Sep 11, 2017

Thank you, guys.

Now, I know what causes the problem, but I do not know why.

My “config.toml” says:

[outputs]
page = ["HTML", "Calendar"]

It is the Calendar entry that causes the error. Without it, everything works fine—but, of course, the calendar function is necessary for the project. With that said, I just love Hugo for its custom output formats!

Error occurs with “single.ics” or with “single.calendar.ics”

@bep
Copy link
Member

bep commented Sep 11, 2017

@Brixy OK, then I think I know enough to try to reproduce it. I suspect it is a Go 1.9 issue, which is the only related change from Hugo 0.26.

@bep bep self-assigned this Sep 11, 2017
@pamubay
Copy link

pamubay commented Sep 12, 2017

I also face this issue.

it happened when running hugo server

in 0.26 if we change the shortcode (like Instagram) Hugo rebuild always generate successfully without escaping the html.

in 0.27 when hugo server running then we change the shortcode, the rebuild will produce escaped HTML code.

@bep bep added the Bug label Sep 12, 2017
@bep bep added this to the v0.27.1 milestone Sep 12, 2017
bep added a commit to bep/hugo that referenced this issue Sep 12, 2017
@bep bep changed the title Shortcode html is escaped (v0.27) safeHTML marked HTML data elements (.Site.Data, JSON etc.) are escaped Sep 12, 2017
bep added a commit to bep/hugo that referenced this issue Sep 12, 2017
@bep
Copy link
Member

bep commented Sep 12, 2017

See golang/go#21844

@Brixy
Copy link
Author

Brixy commented Sep 13, 2017

Thank you very much for all your efforts in general and for bringing out v0.27.1 so quickly, @bep.

(Apologies if answering to a closed thread is unprofessional[?].)

@bep
Copy link
Member

bep commented Sep 13, 2017

@Brixy the reason I moved so fast on this was that I suspected that it had to be fixed in Go, and I knew that 1.9.1 is just around the corner -- so to get a fix in there would require some really fast action. Luckily there was a workaround on the Hugo side of the fence.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants