Meteor pagination with Alethes Pages and Iron Router

In this post I want to write about my last task, a simple pagination. 

If you research at Atmospheejs you’ll see many options available to do this job, but after some reading I decided to use alethes:pages, why?

1 – Because Pages download just what is really necessary, other options copy everything, entire collections to the client side.

2 – Because it’s easy to use with Iron Router.

If you need to implement a pagination I suppose you have a collection of something, in my case Posts.

[code language=”javascript”]

Posts = new Mongo.Collection(“posts”);


What you need to do is just create a new route with Pages so, do that in the same place where are your other controllers, eg:

router: “iron-router” : It tells to Pages setup a new route for you.

routerLayout: “layout” : The layout used by iron router to generate paging. Example.

routerTemplate: “postList” : The template of your list. Example.

templateName: “postList” : The name of your template, if you omit this option, the default is the collection’s name.

itemTemplate: “postItem” : This is a important one, if you omit itemTemplate, a awful list will be provided for you so, use your own template. Example.

[code language=”javascript”]

Pages = new Meteor.Pagination(Posts, {

router: “iron-router”,

routerLayout: “layout”,

routerTemplate: “postList”,

templateName: “postList”,

itemTemplate: “postItem”,

sort: {

createdAt: -1


perPage: 5



After that you just need to write your routerTemplate

[code language=”javascript”]


pages and pagesNav are both provided by Pages, you just need to use it.

And finally, the itemTemplate

It’s pretty simple to use Pages, you can seed a list of options here or if you prefer read code instead documentation, you can visit Page’s repository there are lots of useful examples.

Allan de Queiroz

Allan de Queiroz
London based software engineer

XServer forward from Linux text mode for Headless purposes.

Hello, this post is about XServer forward from Linux text mode, **not ssh forward, anything related to VNC** or things like that.Recently...… Continue reading