A platform for community discussion. Free, open, simple.
FIX: Preserve original text casing in open graph title (#45107)
Kris2add2c129e78
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rbindex 18134c7f4f7..3caecab56fa 100644--- a/app/controllers/groups_controller.rb+++ b/app/controllers/groups_controller.rb@@ -67,7 +67,7 @@ class GroupsController < ApplicationControllergroup = find_group_for_showformat.html do- @title = group.full_name.present? ? group.full_name.capitalize : group.name+ @title = group.full_name.presence || group.name@full_title = "#{@title} - #{SiteSetting.title}"@description_meta = group.bio_summary || @titlerender :showdiff --git a/spec/requests/groups_controller_spec.rb b/spec/requests/groups_controller_spec.rbindex 44f91ba78ff..110bea06d24 100644--- a/spec/requests/groups_controller_spec.rb+++ b/spec/requests/groups_controller_spec.rb@@ -568,6 +568,22 @@ RSpec.describe GroupsController do)end+ it "uses the full name as entered for the HTML title" do+ group.update!(full_name: "Utah - St. George")++ get "/groups/#{group.name}.html"++ expect(response.status).to eq(200)+ expect(response.body).to have_tag "title", text: "Utah - St. George - #{SiteSetting.title}"+ expect(response.body).to have_tag(+ :meta,+ with: {+ property: "og:title",+ content: "Utah - St. George",+ },+ )+ end+it "renders a single-escaped, tag-free meta description from the bio" dogroup.update!(bio_raw: "Tom & Jerry [blog](https://evil.example) win")