From 654d7996aef6309e328285baf95ff5268e42a440 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Wed, 28 Nov 2018 08:06:14 +0530 Subject: [PATCH] FIX: title was repeating on about page --- app/views/about/index.html.erb | 2 -- spec/requests/about_controller_spec.rb | 9 +++++++++ spec/requests/static_controller_spec.rb | 9 +++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) 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 %> -

<%=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("About - Discourse") 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("About - Discourse") + 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("FAQ - Discourse") 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("FAQ - Discourse") + end + end end describe '#enter' do