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

Pagination #7

Closed
Keats opened this issue Mar 21, 2017 · 6 comments
Closed

Pagination #7

Keats opened this issue Mar 21, 2017 · 6 comments

Comments

@Keats
Copy link
Collaborator

Keats commented Mar 21, 2017

Pagination

A few cases to consider:

  • simple blog, with/without pagination
  • site: typically no pagination
  • site + blog: pagination on some bits only potentially (the blog)
  • random site with pagination on some sections (like a knowledge base for example)

Default is no pagination at all.

Then people can add paginations for whatever section they want. We need 3 elements for each pagination: (section_name, num_per_page, path_name).

Example of mixed site+blog content folder:

content
 - about.md
 - pricing.md
 - blog
   - article1.md
  • section_name: for example you can use blog and it will generate pagination for all the pages in blog. The only way I can see it working for the basic blog is to have a magic name, like base that will work on the first level in the content folder
  • num_per_page: how many pages on each page of the pagination
  • path_name: what goes in the url for the pagination. For example, if I use "page", the second page will be mysite.com/page/2

We can potentially have several type of contents needing pagination, but since I'm not using pagination at all myself, one basic level should be fine to start with.

EDIT: outdated, see below

@Keats
Copy link
Collaborator Author

Keats commented Mar 21, 2017

Now that we have a _index.md for sections we could use its front matter to setup pagination but that doesn't really work in the case of a simple blog with only posts.

We could have a default pagination setting in config.toml for that case but it feels like having the behaviour in 2 places.

The sensible way (it seems) is to:

  • have a default for pagination in config.toml: defaults to no pagination but can be set up to paginate by setting num_per_page, pagination_path and paginate. This will apply to the index only.
  • Sections have to enable paginations and can override num_per_page and path_name in their frontmatter, no pagination will be created implicitely.

pagination_path is the path to be used in the URL, it could be page by default. It would like mysite.com/page/2 etc in that case.

That should cover 99% of the cases

@Keats Keats mentioned this issue Mar 24, 2017
6 tasks
@Keats Keats modified the milestone: 0.1.0 Mar 24, 2017
@Keats
Copy link
Collaborator Author

Keats commented Apr 10, 2017

We could also have a _index.md for the actual index page instead of putting the default in the config but I'm not sure it's worth it.
In practice, in a mixed content site (landing page + blog for example), the index page will not be the one paginated. I can't think of an example where it would be the case: paginating different kind of content doesn't really make sense.

@Keats
Copy link
Collaborator Author

Keats commented Apr 13, 2017

No clue on how to handle pagination for the index page: what do you do if you have a couple of static pages + posts? Having your about page in the pagination doesn't make sense.

I'll only paginate sections for now and we can figure out the index section later (maybe only paginate pages that have a date or a weight?)

@Keats
Copy link
Collaborator Author

Keats commented Apr 16, 2017

See #34 for basic implementation, doesn't paginate index page yet

@Keats
Copy link
Collaborator Author

Keats commented Apr 22, 2017

Will be easier after #14 to generalise I think and with the _index.md for the index page

@Keats
Copy link
Collaborator Author

Keats commented May 3, 2017

#55 should do the trick

@Keats Keats closed this as completed May 3, 2017
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant