I’d like to introduce a new pagination style to Hugo. I want to do the development part but I need to know how to integrate with the current code, if the contribution is likely to be integrated or not, and the guidelines I could follow for that.
basically, I am unsatisfied by the current pagination algorithm. Say you have 13 articles with pages containing 5 articles max, with A the oldest article and M the newest. I am considering the content of the following pages:
- /articles/: the front page
They will be organized like this in Hugo :
front page: [M L K J I] (identical as page 1) pagination: [M L K J I] [H G F E D] [C B A ] [ page 1 ] [ page 2 ] [ page 3 ]
The front page is the same page as the page 1. Articles are organized from the most recent up to the oldest. Now, say I write another article N, it will shift all other articles in all pages like this:
front page: [N M L K J] (identical as page 1) pagination: [N M L K J] [I H G F E] [D C B A ] [ page 1 ] [ page 2 ] [ page 3 ]
I have another pagination scheme in mind that paginates things differently in the front page (/articles/) and on the first page (/articles/pages/1/). Articles are presented from last to first up to a limit of 5 articles on the front page. Other pages show articles from first to last, the very first article appearing on page 1. Articles from A to M would show like this:
front page: [M L K J I] pagination: [A B C D E] [F G H I J] [K L M ] [ page 1 ] [ page 2 ] [ page 3 ]
When the ne article N is added, it only changes the front page and the page 3:
front page: [N M L K J] pagination: [A B C D E] [F G H I J] [K L M N ] [ page 1 ] [ page 2 ] [ page 3 ]
One of the main benefit of this pagination model is that old pages (page 1 and 2 in the example) are left unchanged. This can be great to have permanent URLs and can also be great for caching.
@bep I see that you wrote most of the pagination code. What do you think about this?