New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Pagination #1198

Merged
merged 8 commits into from Jun 23, 2013

Conversation

Projects
None yet
4 participants
@parkr
Member

parkr commented Jun 9, 2013

New: Look for an index.html page starting in the paginate_path and searching upward (in the FS tree) until an index.html is found.

  • paginate in subdirectories properly
  • traverse hierarchy (vertically) to find proper index.html file
  • add tests for new cases
  • fix tests for internals that were changed
@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Jun 9, 2013

Member

@mattr- this is ready for review :)

Member

parkr commented Jun 9, 2013

@mattr- this is ready for review :)

@@ -29,7 +29,7 @@ class Configuration < Hash
'baseurl' => '/',
'include' => ['.htaccess'],
'exclude' => [],
'paginate_path' => 'page:num',
'paginate_path' => '/page:num',

This comment has been minimized.

@mattr-

mattr- Jun 10, 2013

Member

I'm missing some context for this change. How is the added slash significant here?

@mattr-

mattr- Jun 10, 2013

Member

I'm missing some context for this change. How is the added slash significant here?

This comment has been minimized.

@parkr

parkr Jun 10, 2013

Member

It's not significant as far as I know.

@parkr

parkr Jun 10, 2013

Member

It's not significant as far as I know.

This comment has been minimized.

@parkr

parkr Jun 10, 2013

Member

I was just testing with both :)

@parkr

parkr Jun 10, 2013

Member

I was just testing with both :)

# site - the Jekyll::Site object
#
# Returns the url of the template page
def self.first_page_url(site)

This comment has been minimized.

@mattr-

mattr- Jun 10, 2013

Member

Do we have a URL helpers module or something where this method could go instead? I don't think this method belongs on the Pagination class.

@mattr-

mattr- Jun 10, 2013

Member

Do we have a URL helpers module or something where this method could go instead? I don't think this method belongs on the Pagination class.

This comment has been minimized.

@parkr

parkr Jun 22, 2013

Member

URL Helpers? Nope. Might be a good idea to add, but I'd rather do that in a different PR. It could also handle generation of URLs for Pages and Posts.

@parkr

parkr Jun 22, 2013

Member

URL Helpers? Nope. Might be a good idea to add, but I'd rather do that in a different PR. It could also handle generation of URLs for Pages and Posts.

This comment has been minimized.

@parkr

parkr Jun 23, 2013

Member

What do you think about this? Do you think a URL Helper to cover these two things is a good idea?

@parkr

parkr Jun 23, 2013

Member

What do you think about this? Do you think a URL Helper to cover these two things is a good idea?

This comment has been minimized.

@mattr-

mattr- Jun 25, 2013

Member

I don't really see the pattern that I was seeing before so I don't think we need a URL Helper to cover these two things anymore.

@mattr-

mattr- Jun 25, 2013

Member

I don't really see the pattern that I was seeing before so I don't think we need a URL Helper to cover these two things anymore.

# site - the Jekyll::Site object
#
# Returns the Jekyll::Page which will act as the pager template
def template_page(site)

This comment has been minimized.

@mattr-

mattr- Jun 10, 2013

Member

hmm, after seeing this method, I'm wondering if we don't need a TemplatePage object for both this method and the previous method. Thoughts?

@mattr-

mattr- Jun 10, 2013

Member

hmm, after seeing this method, I'm wondering if we don't need a TemplatePage object for both this method and the previous method. Thoughts?

#
# Returns the path with a leading slash
def self.ensure_leading_slash(path)
path[0..0] == "/" ? path : "/#{path}"

This comment has been minimized.

@mattr-

mattr- Jun 10, 2013

Member

Why use a range here?

@mattr-

mattr- Jun 10, 2013

Member

Why use a range here?

This comment has been minimized.

@parkr

parkr Jun 10, 2013

Member

Compatibility with 1.8.7. In 1.8.7, string[index] returns the ordinal instead of the character.

@parkr

parkr Jun 10, 2013

Member

Compatibility with 1.8.7. In 1.8.7, string[index] returns the ordinal instead of the character.

assert_equal("page-2", Pager.paginate_path(Jekyll::Configuration::DEFAULTS.merge('paginate_path' => '/blog/page-:num'), 2))
assert_equal("/index.html", Pager.paginate_path(build_site, 1))
assert_equal("/page2", Pager.paginate_path(build_site, 2))
assert_equal("/index.html", Pager.paginate_path(build_site({'paginate_path' => '/blog/page-:num'}), 1))

This comment has been minimized.

@mattr-

mattr- Jun 10, 2013

Member

This passes but I don't understand why.

Shouldn't we end up with /blog/index.html here?

@mattr-

mattr- Jun 10, 2013

Member

This passes but I don't understand why.

Shouldn't we end up with /blog/index.html here?

This comment has been minimized.

@parkr

parkr Jun 10, 2013

Member

No! There's no index.html file in the /blog folder so it'll fall back to the root index.html.

@parkr

parkr Jun 10, 2013

Member

No! There's no index.html file in the /blog folder so it'll fall back to the root index.html.

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Jun 22, 2013

Member

@mattr- – Any further comments? I think I'd like to hold off on the URL Helper for a different PR.

Member

parkr commented Jun 22, 2013

@mattr- – Any further comments? I think I'd like to hold off on the URL Helper for a different PR.

@mattr-

This comment has been minimized.

Show comment
Hide comment
@mattr-

mattr- Jun 23, 2013

Member

I'm cool with that. :shipit: 👍

On Sat, Jun 22, 2013 at 10:08 AM, Parker Moore notifications@github.com
wrote:

@mattr- – Any further comments? I think I'd like to hold off on the URL Helper for a different PR.

Reply to this email directly or view it on GitHub:
#1198 (comment)

Member

mattr- commented Jun 23, 2013

I'm cool with that. :shipit: 👍

On Sat, Jun 22, 2013 at 10:08 AM, Parker Moore notifications@github.com
wrote:

@mattr- – Any further comments? I think I'd like to hold off on the URL Helper for a different PR.

Reply to this email directly or view it on GitHub:
#1198 (comment)

parkr added a commit that referenced this pull request Jun 23, 2013

@parkr parkr merged commit f9d1739 into master Jun 23, 2013

1 check passed

default The Travis CI build passed
Details

@parkr parkr deleted the fix-pagination branch Jun 23, 2013

parkr added a commit that referenced this pull request Jun 23, 2013

@wakproductions

This comment has been minimized.

Show comment
Hide comment
@wakproductions

wakproductions Dec 23, 2013

This change seems to break the pagination plugin in Octopress. Using Octopress 2.5, its pagination plugin takes two arguments for pagination_enabled? When I do a $ jekyll build it gives me an error: Generating... /Users/wkotzan/Google Drive/Development/sites/winstonkotzancom/plugins/pagination.rb:72:in `pagination_enabled?': wrong number of arguments (1 for 2) (ArgumentError)

This change seems to break the pagination plugin in Octopress. Using Octopress 2.5, its pagination plugin takes two arguments for pagination_enabled? When I do a $ jekyll build it gives me an error: Generating... /Users/wkotzan/Google Drive/Development/sites/winstonkotzancom/plugins/pagination.rb:72:in `pagination_enabled?': wrong number of arguments (1 for 2) (ArgumentError)

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Dec 24, 2013

Member

Yeah, 2.5 isn't ready for prime-time.

Member

parkr replied Dec 24, 2013

Yeah, 2.5 isn't ready for prime-time.

@jekyll jekyll 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.