How do you paginate category pages?

701 views
Skip to first unread message

albedoa

unread,
Mar 24, 2011, 1:16:56 PM3/24/11
to jekyll.rb
This question has popped up a few times, but it goes ignored. Has
anyone accomplished this yet?

Some have suggested paginating the whole site, then conditionally
checking for the category in each post before displaying it. This
doesn't work because Jekyll reserves N posts per page, regardless of
whether the category matches. (So if you have N=20 posts per page, and
none of the 20 posts on a page match the category, then a blank page
is generated.)

I'm very interested to hear what others have tried and whether they
were successful.

Mark Szymanski

unread,
Mar 25, 2011, 7:00:04 PM3/25/11
to jeky...@googlegroups.com
I have had the same issue and would love an answer to this.
--
You received this message because you are subscribed to the Google Groups "jekyll.rb" group.
To post to this group, send email to jeky...@googlegroups.com.
To unsubscribe from this group, send email to jekyll-rb+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jekyll-rb?hl=en.

jpcody

unread,
Mar 28, 2011, 3:56:44 PM3/28/11
to jekyll.rb
A friend did this for me. His fork is at https://github.com/danreedy/jekyll

Just generate your site with ../path/to/bin/jekyll --paginate ## with
whatever pagination could you want.

As of now, I'm working on pagination within a category and moving the
--paginate XX option from the command to the YAML, but I'm just
getting started with Ruby, so it might be awhile :)

jpcody

unread,
Mar 28, 2011, 4:04:43 PM3/28/11
to jekyll.rb
Also, this looks promising: https://github.com/blackwinter/jekyll-pagination

On Mar 28, 12:56 pm, jpcody <joshc...@gmail.com> wrote:
> A friend did this for me. His fork is athttps://github.com/danreedy/jekyll

Captain Canine

unread,
Mar 30, 2011, 11:41:34 AM3/30/11
to jekyll.rb
I've done this on my site (http://www.marran.com). Take a look at
https://github.com/pelosi/marran.com. The plugin is
generate_category_pages.rb. Feel free to ask me questions.

Captain Canine

unread,
Mar 31, 2011, 1:30:29 PM3/31/11
to jekyll.rb
And I put up a web page to walk through the code:
http://www.marran.com/tech/category-pagination-in-jekyll/

On Mar 30, 11:41 am, Captain Canine <ke...@marran.com> wrote:
> I've done this on my site (http://www.marran.com). Take a look athttps://github.com/pelosi/marran.com. The plugin is

Kwpolska

unread,
Mar 31, 2011, 2:41:31 PM3/31/11
to jeky...@googlegroups.com
On Wed, Mar 30, 2011 at 08:41:34AM -0700, Captain Canine wrote:
> I've done this on my site (http://www.marran.com). Take a look at
> https://github.com/pelosi/marran.com. The plugin is
> generate_category_pages.rb. Feel free to ask me questions.

Why the generator puts older posts first?

Kwpolska

unread,
Mar 31, 2011, 2:59:28 PM3/31/11
to jeky...@googlegroups.com
I wrote:
> Why the generator puts older posts first?

Well, this isn't correct. The generator works fine for 4 categories on my blog, but with two, it has problems. The first one is a ``GNU/Linux"[1] category (yeah, I don't want RMS to visit my mailbox), where the two posts are in reverse order, while the ``WordPress"[2] category is a total mess. It goes for a random order. WTF?

[1]: http://kwpolska.co.cc/gnulinux/ "GNU/Linux category"
[2]: http://kwpolska.co.cc/wordpress/ "WordPress category"

Reply all
Reply to author
Forward
0 new messages