No release in over 3 years
Low commit activity in last 3 years
adds ability to generate seo link-tags for will_paginate pages
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

< 5.3, >= 4
 Project Readme

rails_will_paginate_seo_helper

This is standing on the shoulder of a giant: ❤️ https://github.com/mislav/will_paginate and adds some seo-sugar on top.

A simple Rails ViewHelper to display link-tags for will_paginate in header.

Url-Parameter left untouched.

Atm. expects 'page' as page_param -key.

Google suggests to add rel=next and rel=prev link-tags on paged pages: https://webmasters.googleblog.com/2011/09/pagination-with-relnext-and-relprev.html

If you want to have seo link-tags for pages in your rails app without monkey patching will_paginate:

Setup

simple add to your Gemfile:

 # works with rails 4 and 5
 gem 'will_paginate'
 gem 'rails_will_paginate_seo_helper'

Usage

a will_paginate paged ActiveRecord::Relation from your controller:

@todos = Todo.all.paginate(page: params[:page])

now you can use on your templates (expects <%= yield :pagination_rel_links %> in the header section of your layout)

 <!-- in todos/index.html.erb -->
 <% content_for :pagination_rel_links do %>
  <!-- this will showup in the header section of your html -->
  <%= will_paginate_seo_links(@todos) %>
 <% end %>

given we are on page 2 - output will be:

<link href="http://localhost:3000/todos" rel="prev">
<link href="http://localhost:3000/todos?page=3" rel="next">