Skip to content
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 Absolute permalinks break paginator when permalink is specified for index file #5 #23

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ducktyper
Copy link

There were two issues related to absolute permalink in index file.

  1. Absolute permalink in index file is also set to paginated pages so they all have the same url. As a result, index page shows the last paginated page.
  2. Paginator looks for index file based on permalink not source location. so if permalink is not matched to index file path then paginated pages become blank pages.

Since this is my first commit to a open-source project, let me know anything I have missed or can improve.

Thanks.

page
end
def source_to_file_path(page)
page.url_placeholders[:path] # meant to use page.instance_variable_get('@dir')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

page.path?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried with page.path but test was failed since this includes filename.
File.dirname(page.path) seems to be another solution clearer than page.url_placeholders[:path]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try page.relative_path then 😄 There was a liquid inconsistency that this will bump into.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants