Skip to content

A platform for community discussion. Free, open, simple.

FIX: static page title should be consistent on client side and server side

Arpit Jalanbdb1268528ee
diff --git a/app/controllers/about_controller.rb b/app/controllers/about_controller.rb
index a95cedfca73..3408239865b 100644
--- a/app/controllers/about_controller.rb
+++ b/app/controllers/about_controller.rb
@@ -10,6 +10,7 @@ class AboutController < ApplicationController
return redirect_to path('/login') if SiteSetting.login_required? && current_user.nil?
@about = About.new
+ @title = "#{I18n.t("js.about.simple_title")} - #{SiteSetting.title}"
respond_to do |format|
format.html do
render :index
diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb
index c6252dfb784..43b4a851ab7 100644
--- a/app/controllers/static_controller.rb
+++ b/app/controllers/static_controller.rb
@@ -39,7 +39,12 @@ class StaticController < ApplicationController
if map.has_key?(@page)
@topic = Topic.find_by_id(SiteSetting.send(map[@page][:topic_id]))
raise Discourse::NotFound unless @topic
- @title = "#{@topic.title} - #{SiteSetting.title}"
+ title_prefix = if I18n.exists?("js.#{@page}")
+ I18n.t("js.#{@page}")
+ else
+ @topic.title
+ end
+ @title = "#{title_prefix} - #{SiteSetting.title}"
@body = @topic.posts.first.cooked
@faq_overriden = !SiteSetting.faq_url.blank?
render :show, layout: !request.xhr?, formats: [:html]
diff --git a/app/views/about/index.html.erb b/app/views/about/index.html.erb
index 563a9600c83..e27fb7e9836 100644
--- a/app/views/about/index.html.erb
+++ b/app/views/about/index.html.erb
@@ -105,6 +105,13 @@
<% end %>
-<% content_for :head do %>
- <%= raw crawlable_meta_data(title: SiteSetting.title, description: SiteSetting.site_description) %>
+<% if @title %>
+ <% content_for :title do %><%= @title %><% end %>
+ <% content_for :head do %>
+ <%= raw crawlable_meta_data(title: @title, description: SiteSetting.site_description) %>
+ <% end %>
+<% else %>
+ <% content_for :head do %>
+ <%= raw crawlable_meta_data(title: SiteSetting.title, description: SiteSetting.site_description) %>
+ <% end %>
<% end %>