FIX: include canonical meta tag on category pages
This commit is contained in:
parent
d3ee5752b8
commit
72c92b0f4e
|
@ -111,6 +111,7 @@ class ListController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def category_default
|
def category_default
|
||||||
|
canonical_url "#{Discourse.base_url_no_prefix}#{@category.url}"
|
||||||
view_method = @category.default_view
|
view_method = @category.default_view
|
||||||
view_method = 'latest' unless %w(latest top).include?(view_method)
|
view_method = 'latest' unless %w(latest top).include?(view_method)
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,22 @@ describe ListController do
|
||||||
xhr :get, :category_default, category: category.slug
|
xhr :get, :category_default, category: category.slug
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "renders canonical tag" do
|
||||||
|
render_views
|
||||||
|
|
||||||
|
it 'for category default view' do
|
||||||
|
get :category_default, category: category.slug
|
||||||
|
expect(response).to be_success
|
||||||
|
expect(css_select("link[rel=canonical]").length).to eq(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'for category latest view' do
|
||||||
|
get :category_latest, category: category.slug
|
||||||
|
expect(response).to be_success
|
||||||
|
expect(css_select("link[rel=canonical]").length).to eq(1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue