diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e36de19255..3d5025724f 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -79,7 +79,7 @@ module ApplicationHelper
def html_title
safe_join(
- [content_for(:page_title).to_s.chomp, title]
+ [content_for(:page_title), title]
.compact_blank,
' - '
)
diff --git a/app/views/about/show.html.haml b/app/views/about/show.html.haml
index 05d8989add..e8f7b43eaa 100644
--- a/app/views/about/show.html.haml
+++ b/app/views/about/show.html.haml
@@ -1,5 +1,4 @@
-- content_for :page_title do
- = t('about.title')
+- content_for :page_title, t('about.title')
- content_for :header_tags do
= render partial: 'shared/og'
diff --git a/app/views/accounts/show.html.haml b/app/views/accounts/show.html.haml
index dde9c50847..1f5f81348e 100644
--- a/app/views/accounts/show.html.haml
+++ b/app/views/accounts/show.html.haml
@@ -1,5 +1,4 @@
-- content_for :page_title do
- #{display_name(@account)} (#{acct(@account)})
+- content_for :page_title, "#{display_name(@account)} (#{acct(@account)})"
- content_for :header_tags do
- if @account.user_prefers_noindex?
diff --git a/app/views/privacy/show.html.haml b/app/views/privacy/show.html.haml
index 95e506641b..9eb4f7a570 100644
--- a/app/views/privacy/show.html.haml
+++ b/app/views/privacy/show.html.haml
@@ -1,5 +1,4 @@
-- content_for :page_title do
- = t('privacy_policy.title')
+- content_for :page_title, t('privacy_policy.title')
- content_for :header_tags do
= render partial: 'shared/og'
diff --git a/app/views/statuses/show.html.haml b/app/views/statuses/show.html.haml
index 08bab63073..f669885de0 100644
--- a/app/views/statuses/show.html.haml
+++ b/app/views/statuses/show.html.haml
@@ -1,5 +1,4 @@
-- content_for :page_title do
- = t('statuses.title', name: display_name(@account), quote: truncate(@status.spoiler_text.presence || @status.text, length: 50, omission: '…', escape: false))
+- content_for :page_title, t('statuses.title', name: display_name(@account), quote: truncate(@status.spoiler_text.presence || @status.text, length: 50, omission: '…', escape: false))
- content_for :header_tags do
- if @account.user_prefers_noindex?
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index ffcc5b81b6..557d08e851 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -257,11 +257,11 @@ RSpec.describe ApplicationHelper do
expect(helper.html_title).to be_html_safe
end
- it 'removes extra new lines' do
+ it 'does not escape twice' do
Setting.site_title = 'Site Title'
- helper.content_for(:page_title, "Test Value\n")
+ helper.content_for(:page_title, '"Test Value"'.html_safe)
- expect(helper.html_title).to eq 'Test Value - Site Title'
+ expect(helper.html_title).to eq '"Test Value" - Site Title'
expect(helper.html_title).to be_html_safe
end
end
diff --git a/spec/views/statuses/show.html.haml_spec.rb b/spec/views/statuses/show.html.haml_spec.rb
index 1afcb046d4..02b1fe7384 100644
--- a/spec/views/statuses/show.html.haml_spec.rb
+++ b/spec/views/statuses/show.html.haml_spec.rb
@@ -18,7 +18,7 @@ RSpec.describe 'statuses/show.html.haml' do
assign(:descendant_threads, [])
end
- it 'has valid opengraph tags' do
+ it 'has valid opengraph tags and twitter player tags' do
render
expect(header_tags)
@@ -26,10 +26,6 @@ RSpec.describe 'statuses/show.html.haml' do
.and match(//)
.and match(//)
.and match(%r{})
- end
-
- it 'has twitter player tag' do
- render
expect(header_tags)
.to match(%r{})