mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: static page title should be consistent on client side and server side
This commit is contained in:
@@ -10,6 +10,7 @@ class AboutController < ApplicationController
|
|||||||
return redirect_to path('/login') if SiteSetting.login_required? && current_user.nil?
|
return redirect_to path('/login') if SiteSetting.login_required? && current_user.nil?
|
||||||
|
|
||||||
@about = About.new
|
@about = About.new
|
||||||
|
@title = "#{I18n.t("js.about.simple_title")} - #{SiteSetting.title}"
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html do
|
format.html do
|
||||||
render :index
|
render :index
|
||||||
|
|||||||
@@ -39,7 +39,12 @@ class StaticController < ApplicationController
|
|||||||
if map.has_key?(@page)
|
if map.has_key?(@page)
|
||||||
@topic = Topic.find_by_id(SiteSetting.send(map[@page][:topic_id]))
|
@topic = Topic.find_by_id(SiteSetting.send(map[@page][:topic_id]))
|
||||||
raise Discourse::NotFound unless @topic
|
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
|
@body = @topic.posts.first.cooked
|
||||||
@faq_overriden = !SiteSetting.faq_url.blank?
|
@faq_overriden = !SiteSetting.faq_url.blank?
|
||||||
render :show, layout: !request.xhr?, formats: [:html]
|
render :show, layout: !request.xhr?, formats: [:html]
|
||||||
|
|||||||
@@ -105,6 +105,13 @@
|
|||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :head do %>
|
<% if @title %>
|
||||||
<%= raw crawlable_meta_data(title: SiteSetting.title, description: SiteSetting.site_description) %>
|
<% 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 %>
|
<% end %>
|
||||||
|
|||||||
Reference in New Issue
Block a user