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

Fix <title> tag double HTML escaping #1626

Merged
merged 1 commit into from
Aug 18, 2017

Conversation

zachmargolis
Copy link
Contributor

Why: To fix rendering in browsers


before:

screenshot_8_18_17__11_21_am 2

after:

screenshot_8_18_17__11_21_am

**Why**: To fix rendering in browsers
@@ -12,7 +12,10 @@ html lang="#{I18n.locale}" class='no-js'
meta http-equiv="refresh" content="#{yield(:meta_refresh)}"

title
= content_for?(:title) ? APP_NAME + ' - ' + yield(:title) : APP_NAME
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the + ends up creating an HTML-unsafe value, where this approach will check each piece separate for HTML-safeness before rendering (the result of the yield may already be HTML safe, as it was in the buggy case)

Copy link
Member

@jmhooper jmhooper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@zachmargolis zachmargolis merged commit 79fc629 into master Aug 18, 2017
@zachmargolis zachmargolis deleted the margolis-fix-title-interpolation branch August 21, 2017 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants