Improved pagination support #521

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet

devknoll commented Mar 8, 2012

  • Exposed some properties in Page that weren't previously available.
  • Folded in jekyll-pagination to support non-Index.html pagination and allowing for paginating files in sub-directories (e.g. /blog/index.html)
    • Defaults to index.html for backward compatibility.
  • Allow for customizing the pagination url style (e.g. /blog/page/:page => /blog/page/1).
    • Defaults to page:page (page#) for backward compatibility.
gmonaco * Exposed some properties in Page that weren't previously available.
* Folded in jekyll-pagination with additional support for paginating files in directories and modifying the pagination url style.
4fcb860

+1 for non-index.html pagination.

Stiivi commented Mar 22, 2012

+1 for customizing pagination URL style. It would be great if I can have project site landing page to be 'about the project' and then to have blog in a sub-directory as '/blog/*'.

A lot of people (including me) have been using custom hacks for pagination in subdirectories – I'd love to have it available by default.

How has this not been accepted yet?!?!?!?

svnpenn commented Apr 11, 2012

@nathggns if you havent noticed there are over 200 issues on this repo, and not a commit in 2 months. I would suggest using a fork or making your own.

@svnpenn How would I go about doing this? Like many others, I installed Jekyll with gem install jekyll. I have no idea how to use a different fork.

If you just want these changes, you can drop the modified pagination.rb and page.rb into your _plugins folder and they will just work. Keep in mind that this won't work with GitHub Pages.

@devknoll Thanks, but I noticed it doesn't work plug and play. What extra work do I have to do? I put that in plugins and it actually broke page1 (blog/index.html)

svnpenn commented Apr 11, 2012

If you just want these changes, you can drop the modified pagination.rb and page.rb into your _plugins folder and they will just work. Keep in mind that this won't work with GitHub Pages.

That is incorrect. It will work with GitHub pages, as long as you dont rely on GitHub's Jekyll to do the transforming.

cpence commented Apr 30, 2012

This would be a great addition! Category pagination seems to be one of the most commonly requested features, and this is a pretty seamless way to get it working.

@mwinckler mwinckler commented on the diff Aug 11, 2012

lib/jekyll/generators/pagination.rb
newpage.pager = pager
- newpage.dir = File.join(page.dir, "page#{num_page}")
+ newpage.dir = File.join(page.dir, template.gsub(/:page/, num_page.to_s))
@mwinckler

mwinckler Aug 11, 2012

In my installation, I had to change this to File.join(page.source_dir instead of page.dir. This was for paginating blog/index.html; as-is it kept generating the page2 folder in the root directory instead of in blog/, as page.dir just returned /. I'm new to Jekyll so I'm not sure if this is a bug with the patch or a bug in my setup or configuration.

+1 on pagination in subdirectories. I host my jekyll blog with gh-pages, so to have this in by default would be great.

+1 on this as well.

mhumeSF commented Oct 8, 2012

+1 for customizing pagination URL style

yanping commented Oct 14, 2012

+1 for pagination in subdirectories

Contributor

bcomnes commented Nov 11, 2012

I would really like to see this. Every way around this limitation feels like a hack, or plugin.

+1 for pagination in subdirectories

lewtds commented Dec 21, 2012

Oh @mojombo please merge this :(

I want these features, but I am no expert on whether this code is worthy or not. But I would love to have this feature available for my github pages blog!

Owner

parkr commented Dec 25, 2012

@devknoll You must add tests before this will be considered for integration into the project. Thanks for the hard work, though.

Owner

parkr commented Dec 26, 2012

@nimbupani The status of this repository and that of GitHub Pages have little to to with one another.

Contributor

bcomnes commented Dec 26, 2012

One workaround to have a paginated blog on a different page than the index with the restrictions of gh-pages is to have your main, non-paginated website pages in your [username].github.com repository, then your paginated blog in a separate repository with the name of whatever sub-page you want your paginated blog under. IE:

This is the main landing page + any other pages: https://github.com/username/username.github.com
And this would be your paginated blog index: https://github.com/username/blog (gh-pages branch)
Don't forget to provide links between the two on each site!

The second website should respect your CNAME that is set in [username].github.com and work seamlessly with that repository. There might even be some creative room for submodules in this mix.

Inspiration for this idea came from how https://github.com/yihui/yihui.github.com deals with two separate languages on his website.

Technically, its two separate sites, but if you want additional pages paginated, and you don't want to use plugins or are deploying to gh-pages, then this works right now.

It would be nice to be able to arbitrarily paginate sections of a site, IE paginated blog index that isn't the main index while also paginating other pages on the same website like an archives page. Octopress has some really basic support for this kind of thing.

Sure. But if it were in the core and if Github Pages were upgraded then
I would have some chance of using it :) For anything, is the first step
not to have it as part of Jekyll?

Owner

parkr commented Jan 18, 2013

Yeppers.

This will require tests so we don't break it in the future.

plc commented Feb 12, 2013

it seems like custom pagination urls were added, but not the ability to paginate content on pages other than the main index.html, for example blog/index.html does not respect the paginate_path – it defaults to blog/page2.

Owner

parkr commented Mar 17, 2013

The modifications to Page that you made here were merged in #536.

@mojombo, what do think about the rest of the changes?

Karmac commented Mar 24, 2013

I can use paginate_path to change the path, but how can I change the index.html file name inside of them?
Thanks.

plc commented Apr 3, 2013

any updates on this? my paginated generated pages don't use the correct layout

parkr referenced this pull request Apr 7, 2013

Closed

Pagination upgrades #936

Owner

parkr commented Apr 9, 2013

Re-done on #936.

parkr closed this Apr 9, 2013

jekyllbot locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.