diff --git a/app/helpers/instance_helper.rb b/app/helpers/instance_helper.rb
new file mode 100644
index 0000000000000000000000000000000000000000..a1c3c3521f9d92b010b1e8c343fd9bcb7fae6216
--- /dev/null
+++ b/app/helpers/instance_helper.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+module InstanceHelper
+  def site_title
+    Setting.site_title.to_s
+  end
+
+  def site_hostname
+    Rails.configuration.x.local_domain
+  end
+end
diff --git a/app/helpers/site_title_helper.rb b/app/helpers/site_title_helper.rb
deleted file mode 100644
index d2caa920388d2a788c23e700ce2061dc9c624c97..0000000000000000000000000000000000000000
--- a/app/helpers/site_title_helper.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-module SiteTitleHelper
-  def site_title
-    Setting.site_title.to_s
-  end
-end
diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb
index 0d9f10a080ec9edd378c9796bdf36da75b6de4e3..e5dbfeeda91ee8270f3b88424a06a44389966f43 100644
--- a/app/mailers/application_mailer.rb
+++ b/app/mailers/application_mailer.rb
@@ -3,4 +3,5 @@
 class ApplicationMailer < ActionMailer::Base
   default from: ENV.fetch('SMTP_FROM_ADDRESS') { 'notifications@localhost' }
   layout 'mailer'
+  helper :instance
 end
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb
index 64ca92a3aca8f58521b825c69e3aa8055adf9f1f..6abf9c9caffef9e537e6315fab582caff6da85b3 100644
--- a/app/mailers/user_mailer.rb
+++ b/app/mailers/user_mailer.rb
@@ -4,6 +4,8 @@ class UserMailer < Devise::Mailer
   default from: ENV.fetch('SMTP_FROM_ADDRESS') { 'notifications@localhost' }
   layout 'mailer'
 
+  helper :instance
+
   def confirmation_instructions(user, token, _opts = {})
     @resource = user
     @token    = token
diff --git a/app/views/about/more.html.haml b/app/views/about/more.html.haml
index 418c9824723f23b0a8a3a2caa51b40dd68731ddb..84b29912cf6cbec8586597fcd11f474482982b9e 100644
--- a/app/views/about/more.html.haml
+++ b/app/views/about/more.html.haml
@@ -1,11 +1,11 @@
 - content_for :page_title do
-  #{Rails.configuration.x.local_domain}
+  = site_hostname
 
 .wrapper.thicc
   .sidebar-layout
     .main
       .panel
-        %h2= Rails.configuration.x.local_domain
+        %h2= site_hostname
 
         - unless @instance_presenter.site_description.blank?
           %p= @instance_presenter.site_description.html_safe
diff --git a/app/views/about/show.html.haml b/app/views/about/show.html.haml
index 60627ab98bfe2968176a2a7e0aa21d4b60f57f47..49ad03557df66ff7841d96210a220534157921f1 100644
--- a/app/views/about/show.html.haml
+++ b/app/views/about/show.html.haml
@@ -2,12 +2,12 @@
   = javascript_include_tag 'application_public', integrity: true
 
 - content_for :page_title do
-  = Rails.configuration.x.local_domain
+  = site_hostname
 
 - content_for :header_tags do
   %meta{ property: 'og:site_name', content: site_title }/
   %meta{ property: 'og:type', content: 'website' }/
-  %meta{ property: 'og:title', content: Rails.configuration.x.local_domain }/
+  %meta{ property: 'og:title', content: site_hostname }/
   %meta{ property: 'og:description', content: strip_tags(@instance_presenter.site_description.presence || t('about.about_mastodon')) }/
   %meta{ property: 'og:image', content: asset_url('mastodon_small.jpg') }/
   %meta{ property: 'og:image:width', content: '400' }/
@@ -72,7 +72,7 @@
           = t 'about.features.api'
 
   - unless @instance_presenter.site_description.blank?
-    %h3= t('about.description_headline', domain: Rails.configuration.x.local_domain)
+    %h3= t('about.description_headline', domain: site_hostname)
     %p= @instance_presenter.site_description.html_safe
 
   .actions
diff --git a/app/views/about/terms.en.html.haml b/app/views/about/terms.en.html.haml
index e1766ca163cdfbaa2acb15103a68b610c5267d21..7e0fb94c2135479834182ba38b2eb62dcd1683fa 100644
--- a/app/views/about/terms.en.html.haml
+++ b/app/views/about/terms.en.html.haml
@@ -1,5 +1,5 @@
 - content_for :page_title do
-  #{Rails.configuration.x.local_domain} Terms of Service and Privacy Policy
+  #{site_hostname} Terms of Service and Privacy Policy
 
 .wrapper
   %h2 Privacy Policy
diff --git a/app/views/about/terms.no.html.haml b/app/views/about/terms.no.html.haml
index 32ec57ed19d17a4947cd0b81c068f65104857174..46f62950df1a0ccd35af9dcd117becf21d956c31 100644
--- a/app/views/about/terms.no.html.haml
+++ b/app/views/about/terms.no.html.haml
@@ -1,5 +1,5 @@
 - content_for :page_title do
-  #{Rails.configuration.x.local_domain} Personvern og villkår for bruk av nettstedet
+  #{site_hostname} Personvern og villkår for bruk av nettstedet
 
 .wrapper
   %h2 Personvernserklæring
diff --git a/app/views/accounts/show.html.haml b/app/views/accounts/show.html.haml
index 9a70fd16fe05967d4945657467011546aec7b5db..b01f3c4e3e5842c5cb94fbae1bc3e362dc950176 100644
--- a/app/views/accounts/show.html.haml
+++ b/app/views/accounts/show.html.haml
@@ -7,7 +7,7 @@
 
   %meta{ property: 'og:site_name', content: site_title }/
   %meta{ property: 'og:type', content: 'profile' }/
-  %meta{ property: 'og:title', content: "#{@account.username} on #{Rails.configuration.x.local_domain}" }/
+  %meta{ property: 'og:title', content: "#{@account.username} on #{site_hostname}" }/
   %meta{ property: 'og:description', content: @account.note }/
   %meta{ property: 'og:image', content: full_asset_url(@account.avatar.url(:original)) }/
   %meta{ property: 'og:image:width', content: '120' }/
@@ -18,7 +18,7 @@
   = render partial: 'shared/landing_strip', locals: { account: @account }
 
 .h-feed
-  %data.p-name{ value: "#{@account.username} on #{Rails.configuration.x.local_domain}" }/
+  %data.p-name{ value: "#{@account.username} on #{site_hostname}" }/
 
   = render 'header', account: @account
 
diff --git a/app/views/api/oembed/show.json.rabl b/app/views/api/oembed/show.json.rabl
index 311c02dadd74f658789090ad8ad4fefb5244399b..11dcec538c506fe24e0a0f02917a5a76bf66c6fd 100644
--- a/app/views/api/oembed/show.json.rabl
+++ b/app/views/api/oembed/show.json.rabl
@@ -6,7 +6,7 @@ node(:version) { '1.0' }
 node(:title, &:title)
 node(:author_name) { |entry| entry.account.display_name.blank? ? entry.account.username : entry.account.display_name }
 node(:author_url) { |entry| account_url(entry.account) }
-node(:provider_name) { Rails.configuration.x.local_domain }
+node(:provider_name) { site_hostname }
 node(:provider_url) { root_url }
 node(:cache_age) { 86_400 }
 node(:html) { |entry| "<iframe src=\"#{embed_account_stream_entry_url(entry.account, entry)}\" style=\"width: 100%; overflow: hidden\" frameborder=\"0\" width=\"#{@width}\" height=\"#{@height}\" scrolling=\"no\"></iframe>" }
diff --git a/app/views/api/v1/instances/show.rabl b/app/views/api/v1/instances/show.rabl
index 88eb08a9e86fbbb4703e0a6455f39d6acdbbe73d..f5598fde386af14f2a50a316895bfc8dd02f03dd 100644
--- a/app/views/api/v1/instances/show.rabl
+++ b/app/views/api/v1/instances/show.rabl
@@ -1,6 +1,6 @@
 object false
 
-node(:uri)         { Rails.configuration.x.local_domain }
+node(:uri)         { site_hostname }
 node(:title)       { Setting.site_title }
 node(:description) { Setting.site_description }
 node(:email)       { Setting.site_contact_email }
diff --git a/app/views/home/initial_state.json.rabl b/app/views/home/initial_state.json.rabl
index ce7bfbd44cfd4a724bd9796f019b840150167ccd..10404938798207b948a7b7d86414ea85580e624f 100644
--- a/app/views/home/initial_state.json.rabl
+++ b/app/views/home/initial_state.json.rabl
@@ -5,7 +5,7 @@ node(:meta) do
     streaming_api_base_url: @streaming_api_base_url,
     access_token: @token,
     locale: I18n.locale,
-    domain: Rails.configuration.x.local_domain,
+    domain: site_hostname,
     me: current_account.id,
     admin: @admin.try(:id),
     boost_modal: current_account.user.setting_boost_modal,
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index fa5811fd88ad409ca8574ef06f08eebe567998a5..688deaebd5208fde6f34611eb1609874334c7959 100755
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -14,7 +14,7 @@
 
     %title<
       - if content_for?(:page_title)
-        = yield(:page_title)
+        = yield(:page_title).strip
         = ' - '
       = site_title
 
diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb
index 21bf444c374e8d1cbf0ecf2fa69c30febc0ae010..cdb284de831352dc43e52bf89c69307f67b9f09f 100644
--- a/app/views/layouts/mailer.text.erb
+++ b/app/views/layouts/mailer.text.erb
@@ -1,5 +1,5 @@
 <%= yield %>
 ---
 
-<%= t('application_mailer.signature', instance: Rails.configuration.x.local_domain) %>
+<%= t('application_mailer.signature', instance: site_hostname) %>
 <%= t('application_mailer.settings', link: settings_preferences_url) %>
diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml
index fdde0a681388bd47efd554cecd9aa03227f29960..556102f538046e7487fa22c69c8524eb89a4b06b 100644
--- a/app/views/layouts/public.html.haml
+++ b/app/views/layouts/public.html.haml
@@ -4,7 +4,7 @@
 - content_for :content do
   .container= yield
   .footer
-    %span.domain= link_to Rails.configuration.x.local_domain, root_path
+    %span.domain= link_to site_hostname, root_path
     %span.powered-by
       = t('generic.powered_by', link: link_to('Mastodon', 'https://github.com/tootsuite/mastodon')).html_safe
 
diff --git a/app/views/shared/_landing_strip.html.haml b/app/views/shared/_landing_strip.html.haml
index 3536c5ca8ceba78d253f941631478a89e31b74f7..02e694418f30dda760ede32b6578a50bb4a4d61d 100644
--- a/app/views/shared/_landing_strip.html.haml
+++ b/app/views/shared/_landing_strip.html.haml
@@ -1,5 +1,5 @@
 .landing-strip
   = t('landing_strip_html',
     name: content_tag(:span, display_name(account), class: :emojify),
-    domain: Rails.configuration.x.local_domain,
+    domain: site_hostname,
     sign_up_path: new_user_registration_path)
diff --git a/app/views/stream_entries/show.html.haml b/app/views/stream_entries/show.html.haml
index dea5e9d4080e1bc0ece3bbfdc520f4ad585003e3..31efa26c4200219b43069a74ffc0eae4df3d2427 100644
--- a/app/views/stream_entries/show.html.haml
+++ b/app/views/stream_entries/show.html.haml
@@ -4,7 +4,7 @@
 
   %meta{ property: 'og:site_name', content: site_title }/
   %meta{ property: 'og:type', content: 'article' }/
-  %meta{ property: 'og:title', content: "#{@account.username} on #{Rails.configuration.x.local_domain}" }/
+  %meta{ property: 'og:title', content: "#{@account.username} on #{site_hostname}" }/
 
   = render 'stream_entries/og_description', activity: @stream_entry.activity
   = render 'stream_entries/og_image', activity: @stream_entry.activity, account: @account
diff --git a/spec/helpers/instance_helper_spec.rb b/spec/helpers/instance_helper_spec.rb
new file mode 100644
index 0000000000000000000000000000000000000000..c42ed693886e9ca65b63762a0a26a294734c36ca
--- /dev/null
+++ b/spec/helpers/instance_helper_spec.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+describe InstanceHelper do
+  describe 'site_title' do
+    it 'Uses the Setting.site_title value when it exists' do
+      Setting.site_title = 'New site title'
+
+      expect(helper.site_title).to eq 'New site title'
+    end
+
+    it 'returns empty string when Setting.site_title is nil' do
+      Setting.site_title = nil
+
+      expect(helper.site_title).to eq ''
+    end
+  end
+
+  describe 'site_hostname' do
+    around(:each) do |example|
+      before = Rails.configuration.x.local_domain
+      example.run
+      Rails.configuration.x.local_domain = before
+    end
+
+    it 'returns the local domain value' do
+      Rails.configuration.x.local_domain = 'example.com'
+
+      expect(helper.site_hostname).to eq 'example.com'
+    end
+  end
+end
diff --git a/spec/helpers/site_title_helper_spec.rb b/spec/helpers/site_title_helper_spec.rb
deleted file mode 100644
index 8cfd9cba1c846fccb322d1f379f46db048eaef9d..0000000000000000000000000000000000000000
--- a/spec/helpers/site_title_helper_spec.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require "rails_helper"
-
-describe "site_title" do
-  it "Uses the Setting.site_title value when it exists" do
-    Setting.site_title = "New site title"
-
-    expect(helper.site_title).to eq "New site title"
-  end
-
-  it "returns empty string when Setting.site_title is nil" do
-    Setting.site_title = nil
-
-    expect(helper.site_title).to eq ""
-  end
-end