This code was originally written by Bruce Williams, and it is available as the Paginator gem. I’ve added a few helper methods and modifications so it plays a little more nicely with Webby. Specifically, a Webby::Resource can be given to the Page and used to generate links to the previous and next pages.
Many thanks to Bruce Williams for letting me use his work. Drop him a note of praise scribbled on the back of a $100 bill. He’d appreciate it.