--- /dev/null
+# frozen_string_literal: true
+
+module SiteTitleHelper
+ def site_title
+ Setting.site_title.to_s
+ end
+end
= Rails.configuration.x.local_domain
- content_for :header_tags do
- %meta{ property: 'og:site_name', content: 'Mastodon' }/
+ %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:description', content: @description.blank? ? "Mastodon is a free, open-source social network server. A decentralized alternative to commercial platforms, it avoids the risks of a single company monopolizing your communication. Anyone can run Mastodon and participate in the social network seamlessly" : strip_tags(@description) }/
%link{ rel: 'salmon', href: api_salmon_url(@account.id) }/
%link{ rel: 'alternate', type: 'application/atom+xml', href: account_url(@account, format: 'atom') }/
- %meta{ property: 'og:site_name', content: 'Mastodon' }/
+ %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:description', content: @account.note }/
- if content_for?(:page_title)
= yield(:page_title)
= ' - '
- = Setting.site_title
+ = site_title
= stylesheet_link_tag 'application', media: 'all'
= csrf_meta_tags
%link{ rel: 'alternate', type: 'application/atom+xml', href: account_stream_entry_url(@account, @stream_entry, format: 'atom') }/
%link{ rel: 'alternate', type: 'application/json+oembed', href: api_oembed_url(url: account_stream_entry_url(@account, @stream_entry), format: 'json') }/
- %meta{ property: 'og:site_name', content: 'Mastodon' }/
+ %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}" }/
--- /dev/null
+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