This is a fork of the original will_paginate-bootstrap gem (thank you for the 10 years I used this gem, btw!!!).
The original gem is no longer maintained, so this fork allows me to ensure usage of the LinkRenderer.
Rails 7+'s new built-in pagination offers the
paginate method (and more), but seems to not yet include a defined LinkRenderer.
This gem integrates the Bootstrap pagination component with the will_paginate pagination gem.
Just like will_paginate, Rails and Sinatra are supported.
- For projects using Bundler (like Rails 7+):
- add
gem 'will_paginate-bootstrap5'toGemfile(and then runbundle install).- (this works without needing to add
gem 'will_paginate'toGemfile)
- (this works without needing to add
- add
- Otherwise:
gem install will_paginate-bootstrap5
- Add Bootstrap CSS to your project
- For Rails 7+ projects, use one of the following options:
- install the
boostrapgem - manually download
bootstrap.cssfrom the bootstrap website and save it under[your repo]/vendor/assets/stylesheets- add
//= link_tree ../../../vendor/assets/stylesheets .csstoapp/assets/config/manifest.jsso it gets compiled by sprockets/asset pipeline
- add
- add bootstrap's CDN url within the
<head>of yourapp/views/layout.html.erb - pin the CDN in your
config/importmap.rb
- install the
- For Rails 7+ projects, use one of the following options:
- In your view, use the
renderer: BootstrapPagination::Railsoption with thewill_paginatehelper, for example:
<%= will_paginate @collection, renderer: BootstrapPagination::Rails %>- Load the Bootstrap CSS in your template.
require "will_paginate-bootstrap"in your Sinatra app.- In your view, use the
renderer: BootstrapPagination::Sinatraoption with thewill_paginatehelper, for example:
<%= will_paginate @collection, renderer: BootstrapPagination::Sinatra %>Starting at version 1.0, this gem no longer supports Bootstrap 2.
| Ruby | >= 1.9.2 |
|---|---|
| will_paginate | >= 3.0.3 |
| Bootstrap | >= 5.0.0 |
Bootstrap 2 users can use version 0.2.5 of the original gem, which was the last version to offer Bootstrap 2 support.

