A platform for community discussion. Free, open, simple.
FEATURE: add title tag for group detail page (#13702)
Arpit Jalan953fd2cb5007
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rbindex 3196fa1cb24..14687f789a7 100644--- a/app/controllers/groups_controller.rb+++ b/app/controllers/groups_controller.rb@@ -121,6 +121,7 @@ class GroupsController < ApplicationControllerformat.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) : @titlerender :showenddiff --git a/app/views/groups/show.html.erb b/app/views/groups/show.html.erbindex cc250d46849..e0e82db743a 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.rbindex a519e7eb722..b7a5b3f8822 100644--- a/spec/components/retrieve_title_spec.rb+++ b/spec/components/retrieve_title_spec.rb@@ -33,7 +33,7 @@ describe RetrieveTitle doexpect(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" dotitle = RetrieveTitle.extract_title(<<~HTML<html><title>Good Title</title>diff --git a/spec/requests/groups_controller_spec.rb b/spec/requests/groups_controller_spec.rbindex 340376607af..4b0e22a2685 100644--- a/spec/requests/groups_controller_spec.rb+++ b/spec/requests/groups_controller_spec.rb@@ -411,6 +411,7 @@ describe GroupsController doexpect(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})