This week I had to implement a pagination system for the blog. Because, as I write more posts, the blog needs these kind of features. I started looking around at the blogs I read frequently, and ended up more confused on how to implement these pages than when I started.

Typically a blog presents in the first page, the most recent posts, with the most recent on top, which gives more visibility to the new content in the blog. This makes sense, to hook the reader with the most recent content, instead of old, an sometimes outdated content. However, this is here things get interesting. This first page is typically the page number 1 (one) of the blog, and they offer different types of mechanisms to navigate to older content. There is usually an archive by date of the posts, on a side bar, or the page offers pagination after the last post. We are going to focus on this pagination mechanism.

Let's start with this, blog pagination is weird, here's why. The first page of a blog, is usually numbered with number 1, and contains the most recent content on the blog, page number 2 contains content that is a little older, and so on.. This is contradictory to other things we do, for example, if you keep a diary, the most recent page is not the number 1, unless you are just starting your diary. What makes it even weirder, is that some blogs offer a link to navigate to the older posts, on the left side of the page, and to newer posts on the right side, implying that the older pages are to the left of the current one. Here is a image:

This is ridiculous when you think about it. The pages are numbered in the reverse order compared to a book, and when we insert a new blog post, every post is post is pushed "down", which can generate new pages with a higher number, that contains the older post. This example is way different from the diary. Here is an image that illustrates the insertion of a new post:

Notice how the oldest post here (the one with an "a"), is pushed to the the new page. However, there are other ways to do this pagination. Some other blogs use a pagination system where the pages seem to increase to the right, like in the next image.

Of course, this still has the same problem has the previous pagination system, because the newest posts need to be pushed down, and never stay in the same page. Why is it important for the posts to stay in the same page, you may ask? Well, if you bookmark the page for example, it would be nice to have the same posts has it had before, specially in the case of indexation by a Search Engine. Sometimes the results of a search return a post in one of these dynamic pages, but when we visit the page, the post is no longer there, and that is annoying.

One way to solve this problem of indexation, would be to have it organized like a book, and present only the last page, as in the following example:

As we can see here, this causes a few problem, while in the other systems we control the number of posts we display (3 posts per page, in the examples), this can lead to a page with only one post. Another issue, is that the latest post, is not always at the top when presented to the viewer. This would cause way too much confusion, so I settled implementing the "next/previous" system.

It is the system that is implemented at the moment, even though I don't like it that much. In the future, I will implement an Archive system, that indexes the posts, by year, that way everything is ordered chronologically, with a more understandable system, and which allows to be indexed and bookmarked. Meanwhile, everyone has to suffer with this system... If you have some comment about this topic, hit me up on twitter @AndreBaltazar. (while I don't implement the comment section)

EDIT (2017/02/03 18:20) - Fix title