Consolidate html page title output logic into helper (#27563)

This commit is contained in:
Matt Jankowski authored and GitHub committed 2023-11-09 13:05:57 +00:00
1 parent 9b06c0f24a
commit 548bb30b2a
4 files changed
+55 -2

No files matched your search

+8
View File
@@ -91,6 +91,14 @@ module ApplicationHelper
end
end
def html_title
safe_join(
[content_for(:page_title).to_s.chomp, title]
.select(&:present?),
' - '
)
end
def title
Rails.env.production? ? site_title : "#{site_title} (Dev)"
end
+1 -1
View File
@@ -24,7 +24,7 @@
%meta{ name: 'theme-color', content: '#191b22' }/
%meta{ name: 'apple-mobile-web-app-capable', content: 'yes' }/
%title= content_for?(:page_title) ? safe_join([yield(:page_title).chomp.html_safe, title], ' - ') : title
%title= html_title
= stylesheet_pack_tag 'common', media: 'all', crossorigin: 'anonymous'
= stylesheet_pack_tag current_theme, media: 'all', crossorigin: 'anonymous'