Skip to content

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

FIX: title was repeating on about page

Arpit Jalan654d7996aef6
diff --git a/app/views/about/index.html.erb b/app/views/about/index.html.erb
index e27fb7e9836..34d034c2bac 100644
--- a/app/views/about/index.html.erb
+++ b/app/views/about/index.html.erb
@@ -1,7 +1,5 @@
<% if crawler_layout? %>
-<% content_for :title do %><%=t "about" %> - <%= SiteSetting.title %><% end %>
-
<section itemscope itemtype="https://schema.org/AboutPage">
<h1 itemprop="name">
<%=t "js.about.title", {title: @about.title} %>
diff --git a/spec/requests/about_controller_spec.rb b/spec/requests/about_controller_spec.rb
index cf7ab39d5eb..541333c4614 100644
--- a/spec/requests/about_controller_spec.rb
+++ b/spec/requests/about_controller_spec.rb
@@ -9,6 +9,7 @@ describe AboutController do
get "/about"
expect(response.status).to eq(200)
+ expect(response.body).to include("<title>About - Discourse</title>")
end
it 'should redirect to login page for anonymous user when login_required is true' do
@@ -25,5 +26,13 @@ describe AboutController do
expect(response.status).to eq(200)
end
+
+ context "crawler view" do
+ it "should include correct title" do
+ get '/about', headers: { 'HTTP_USER_AGENT' => 'Googlebot' }
+ expect(response.status).to eq(200)
+ expect(response.body).to include("<title>About - Discourse</title>")
+ end
+ end
end
end
diff --git a/spec/requests/static_controller_spec.rb b/spec/requests/static_controller_spec.rb
index df12d0d6d2b..37a0f4ce6d0 100644
--- a/spec/requests/static_controller_spec.rb
+++ b/spec/requests/static_controller_spec.rb
@@ -101,6 +101,7 @@ describe StaticController do
expect(response.status).to eq(200)
expect(response.body).to include(I18n.t('js.faq'))
+ expect(response.body).to include("<title>FAQ - Discourse</title>")
end
end
@@ -186,6 +187,14 @@ describe StaticController do
end
end
end
+
+ context "crawler view" do
+ it "should include correct title" do
+ get '/faq', headers: { 'HTTP_USER_AGENT' => 'Googlebot' }
+ expect(response.status).to eq(200)
+ expect(response.body).to include("<title>FAQ - Discourse</title>")
+ end
+ end
end
describe '#enter' do