Remove kaminari_path

The main reason to use it was the `rel` attribute for previous/next
pages not being indexed correctly by certain search engines when using a
relative URL. However, AFAIK that only applied to `<link>` tags, not to
`<a>` tags, and only if a `<base>` tag was defined.

In any case, it looks like the same search engines don't use the `rel`
attribute for previous/next to index pages anymore.
This commit is contained in:
Javi Martín
2019-10-11 02:28:00 +02:00
parent 15c49e0c10
commit 11e52dbe98
8 changed files with 7 additions and 11 deletions

View File

@@ -55,10 +55,6 @@ module ApplicationHelper
SiteCustomization::ContentBlock.block_for(name, locale)
end
def kaminari_path(url)
"#{root_url.chomp("\/")}#{url}"
end
def self.asset_data_base64(path)
asset = (Rails.application.assets || ::Sprockets::Railtie.build_environment(Rails.application))
.find_asset(path)

View File

@@ -1,3 +1,3 @@
<li>
<%= link_to t("views.pagination.first"), kaminari_path(url), :remote => remote %>
<%= link_to t("views.pagination.first"), url, :remote => remote %>
</li>

View File

@@ -1,3 +1,3 @@
<li>
<%= link_to t("views.pagination.last"), kaminari_path(url), :remote => remote %>
<%= link_to t("views.pagination.last"), url, :remote => remote %>
</li>

View File

@@ -1,3 +1,3 @@
<li class="pagination-next">
<%= link_to t("views.pagination.next"), kaminari_path(url), :rel => "next", :remote => remote %>
<%= link_to t("views.pagination.next"), url, :rel => "next", :remote => remote %>
</li>

View File

@@ -5,6 +5,6 @@
</li>
<% else %>
<li>
<%= link_to page, kaminari_path(url), { :remote => remote, :rel => page.next? ? "next" : page.prev? ? "prev" : nil } %>
<%= link_to page, url, { :remote => remote, :rel => page.next? ? "next" : page.prev? ? "prev" : nil } %>
</li>
<% end %>

View File

@@ -1,3 +1,3 @@
<li class="pagination-previous">
<%= link_to t("views.pagination.previous"), kaminari_path(url), :rel => "prev", :remote => remote %>
<%= link_to t("views.pagination.previous"), url, :rel => "prev", :remote => remote %>
</li>

View File

@@ -47,7 +47,7 @@ describe "Documents" do
within("ul.pagination") do
expect(page).to have_content("1")
expect(page).to have_link("2", href: admin_site_customization_documents_url(page: 2))
expect(page).to have_link("2", href: admin_site_customization_documents_path(page: 2))
expect(page).not_to have_content("3")
click_link "Next", exact: false
end

View File

@@ -103,7 +103,7 @@ describe "Proposals" do
within("ul.pagination") do
expect(page).to have_content("1")
expect(page).to have_link("2", href: "http://www.example.com/proposals?page=2")
expect(page).to have_link("2", href: "/proposals?page=2")
expect(page).not_to have_content("3")
click_link "Next", exact: false
end