FEATURE: add title tag for group detail page (#13702)
This commit is contained in:
parent
d9eb37be70
commit
953fd2cb50
|
@ -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
|
||||
|
|
|
@ -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 %>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue