FIX: use topic summary for meta description if topic excerpt is blank
This commit is contained in:
parent
1b5ba899a1
commit
42c405a820
|
@ -845,7 +845,7 @@ class TopicsController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
@description_meta = @topic_view.topic.excerpt || @topic_view.summary
|
||||
@description_meta = @topic_view.topic.excerpt.present? ? @topic_view.topic.excerpt : @topic_view.summary
|
||||
store_preloaded("topic_#{@topic_view.topic.id}", MultiJson.dump(topic_view_serializer))
|
||||
render :show
|
||||
end
|
||||
|
|
|
@ -1407,6 +1407,17 @@ RSpec.describe TopicsController do
|
|||
expect(response.headers['Discourse-Readonly']).to eq('true')
|
||||
end
|
||||
end
|
||||
|
||||
describe "image only topic" do
|
||||
it "uses image alt tag for meta description" do
|
||||
post = Fabricate(:post, raw: "![image_description|690x405](upload://sdtr5O5xaxf0iEOxICxL36YRj86.png)")
|
||||
|
||||
get post.topic.url
|
||||
|
||||
body = response.body
|
||||
expect(body).to have_tag(:meta, with: { name: 'description', content: '[image_description]' })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#post_ids' do
|
||||
|
|
Loading…
Reference in New Issue