FEATURE: add title tag for group detail page (#13702)

FEATURE: add title tag for group detail page (#13702)

diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index 3196fa1..14687f7 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -121,6 +121,7 @@ class GroupsController < ApplicationController
 
       format.html do
         @title = group.full_name.present? ? group.full_name.capitalize : group.name
+        @full_title = "#{@title} - #{SiteSetting.title}"
         @description_meta = group.bio_cooked.present? ? PrettyText.excerpt(group.bio_cooked, 300) : @title
         render :show
       end
diff --git a/app/views/groups/show.html.erb b/app/views/groups/show.html.erb
index cc250d4..e0e82db 100644
--- a/app/views/groups/show.html.erb
+++ b/app/views/groups/show.html.erb
@@ -1,3 +1,5 @@
+<% content_for :title do %><%= @full_title %><% end %>
+
 <% content_for :head do %>
   <%= raw crawlable_meta_data(title: @title, description: @description_meta) %>
 <% end %>
diff --git a/spec/components/retrieve_title_spec.rb b/spec/components/retrieve_title_spec.rb
index a519e7e..b7a5b3f 100644
--- a/spec/components/retrieve_title_spec.rb
+++ b/spec/components/retrieve_title_spec.rb
@@ -33,7 +33,7 @@ describe RetrieveTitle do
       expect(title).to eq("Good Title")
     end
 
-    it "will prefer the title from an opengraph tag" do
+    it "will prefer the title over the opengraph tag" do
       title = RetrieveTitle.extract_title(<<~HTML
         <html>
           <title>Good Title</title>
diff --git a/spec/requests/groups_controller_spec.rb b/spec/requests/groups_controller_spec.rb
index 3403766..4b0e22a 100644
--- a/spec/requests/groups_controller_spec.rb
+++ b/spec/requests/groups_controller_spec.rb
@@ -411,6 +411,7 @@ describe GroupsController do
 
       expect(response.status).to eq(200)
 
+      expect(response.body).to have_tag "title", text: "#{group.name} - #{SiteSetting.title}"
       expect(response.body).to have_tag(:meta, with: {
         property: 'og:title', content: group.name
       })

GitHub sha: 953fd2cb5007b0762ab1b6edfeb1b2d54e185e49

This commit appears in #13702 which was approved by eviltrout. It was merged by techAPJ.

This commit has been mentioned on Discourse Meta. There might be relevant details there: