FIX: render canonical URLs
This commit is contained in:
parent
4f7140fb32
commit
a0524ea4d1
|
@ -83,9 +83,10 @@ class TopicsController < ApplicationController
|
||||||
response.headers['X-Robots-Tag'] = 'noindex'
|
response.headers['X-Robots-Tag'] = 'noindex'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
canonical_url UrlHelper.absolute_without_cdn("#{Discourse.base_uri}#{@topic_view.canonical_path}")
|
||||||
|
|
||||||
perform_show_response
|
perform_show_response
|
||||||
|
|
||||||
canonical_url UrlHelper.absolute_without_cdn("#{Discourse.base_uri}#{@topic_view.canonical_path}")
|
|
||||||
rescue Discourse::InvalidAccess => ex
|
rescue Discourse::InvalidAccess => ex
|
||||||
|
|
||||||
if current_user
|
if current_user
|
||||||
|
|
|
@ -521,6 +521,17 @@ describe TopicsController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'show full render' do
|
||||||
|
render_views
|
||||||
|
|
||||||
|
it 'correctly renders canoicals' do
|
||||||
|
topic = Fabricate(:post).topic
|
||||||
|
get :show, topic_id: topic.id, slug: topic.slug
|
||||||
|
expect(response).to be_success
|
||||||
|
expect(css_select("link[rel=canonical]").length).to eq(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'show' do
|
describe 'show' do
|
||||||
|
|
||||||
let(:topic) { Fabricate(:post).topic }
|
let(:topic) { Fabricate(:post).topic }
|
||||||
|
|
Loading…
Reference in New Issue