A platform for community discussion. Free, open, simple.
FIX: categories page crawler view had incorrect URLs
Neil Lalondef4b5eccad3bc
diff --git a/app/views/categories/index.html.erb b/app/views/categories/index.html.erbindex b18334da5c0..012c5ff9990 100644--- a/app/views/categories/index.html.erb+++ b/app/views/categories/index.html.erb@@ -3,9 +3,9 @@<% @category_list.categories.each_with_index do |c, index| %><div class='category' itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'><meta itemprop='position' content='<%= index %>'>- <meta itemprop='url' content='<%= "#{Discourse.base_url}#{c.url}" %>'>+ <meta itemprop='url' content='<%= "#{c.url}" %>'><h2>- <a href='<%= "#{Discourse.base_url}#{c.url}" %>' itemprop='item'>+ <a href='<%= "#{c.url}" %>' itemprop='item'><span itemprop='name'><%= c.name %></span></a></h2>diff --git a/spec/requests/categories_controller_spec.rb b/spec/requests/categories_controller_spec.rbindex 5c6baa466ac..32a6677d83e 100644--- a/spec/requests/categories_controller_spec.rb+++ b/spec/requests/categories_controller_spec.rb@@ -17,6 +17,15 @@ describe CategoriesController doget "/categories"expect(response.body).not_to include('AMAZING AMAZING')end++ it 'web crawler view has correct urls for subfolder install' do+ GlobalSetting.stubs(:relative_url_root).returns('/forum')+ Discourse.stubs(:base_uri).returns("/forum")+ get '/categories', headers: { 'HTTP_USER_AGENT' => 'Googlebot' }+ html = Nokogiri::HTML(response.body)+ expect(html.css('body.crawler')).to be_present+ expect(html.css("a[href=\"/forum/c/#{category.slug}\"]")).to be_present+ endendcontext 'extensibility event' do