FIX: include canonical meta tag on category pages

This commit is contained in:
Arpit Jalan 2017-07-03 13:25:22 +05:30
parent d3ee5752b8
commit 72c92b0f4e
2 changed files with 16 additions and 0 deletions

View File

@ -111,6 +111,7 @@ class ListController < ApplicationController
end
def category_default
canonical_url "#{Discourse.base_url_no_prefix}#{@category.url}"
view_method = @category.default_view
view_method = 'latest' unless %w(latest top).include?(view_method)

View File

@ -219,7 +219,22 @@ describe ListController do
xhr :get, :category_default, category: category.slug
expect(response).to be_success
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