{"id":17548685,"url":"https://github.com/djo/reverse_kaminari","last_synced_at":"2025-10-04T14:17:23.468Z","repository":{"id":2246501,"uuid":"3201214","full_name":"djo/reverse_kaminari","owner":"djo","description":"An example of the reverse pagination","archived":false,"fork":false,"pushed_at":"2014-06-19T10:18:44.000Z","size":172,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-11T17:43:51.928Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://reverse-kaminari.heroku.com/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/djo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-17T16:58:48.000Z","updated_at":"2019-08-13T14:55:34.000Z","dependencies_parsed_at":"2022-09-09T18:00:27.267Z","dependency_job_id":null,"html_url":"https://github.com/djo/reverse_kaminari","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/djo/reverse_kaminari","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djo%2Freverse_kaminari","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djo%2Freverse_kaminari/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djo%2Freverse_kaminari/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djo%2Freverse_kaminari/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/djo","download_url":"https://codeload.github.com/djo/reverse_kaminari/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djo%2Freverse_kaminari/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278322322,"owners_count":25967906,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-21T02:24:46.424Z","updated_at":"2025-10-04T14:17:23.417Z","avatar_url":"https://github.com/djo.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Example of the reverse pagination\n[![Build Status](https://secure.travis-ci.org/Djo/reverse_kaminari.png \"Build Status\")](http://travis-ci.org/Djo/reverse_kaminari)\n\nWith the standard pagination strategy on adding a new content you will have situation when the older content moves from page #1 to page #2 and so on. It leads to issues with SEO, indexing and UX. This example shows you how to implement reverse pagination with [kaminari](https://github.com/amatsuda/kaminari) and floating limit for the first (index) page to avoid such issues.\n\n## How it looks\n\nFor example you need to display 3 posts per page. In this case you will have from 3 to 5 posts on the start page:\n\n9 posts will produce 3 pages with 3 posts on the index:\n\n    9..7 posts on the /posts\n    6..4 posts on the /posts/page-2\n    3..1 posts on the /posts/page-1\n\n10 posts will produce 3 pages with 4 posts on the index:\n\n    10..7 posts on the /posts\n    6..4  posts on the /posts/page-2\n    3..1  posts on the /posts/page-1\n\n11 posts will produce 3 pages with 5 posts on the index:\n\n    11..7 posts on the /posts\n    6..4  posts on the /posts/page-2\n    3..1  posts on the /posts/page-1\n\nAnd posts will produce 4 pages with 3 posts on the index:\n\n    12..10 posts on the /posts\n    9..7   posts on the /posts/page-3\n    6..4   posts on the /posts/page-2\n    3..1   posts on the /posts/page-1\n\n## How it works\n\nTo get this behaviour you need to implement the floating limit for the first page.\n\nIn this example you will find the regular pagination bar in ascending order and offsets in URLs. Example of the pagination bar in descending order with page numbers in routes you can find in the [reverse pagination with will_paginate](https://github.com/Djo/reverse_will_paginate).\n\nAlso look at [https://github.com/Djo/reverse_will_paginate](https://github.com/Djo/reverse_will_paginate).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjo%2Freverse_kaminari","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdjo%2Freverse_kaminari","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjo%2Freverse_kaminari/lists"}