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

Only show a certain number of posts per page. #159

Open
jaredsburrows opened this issue Sep 19, 2017 · 8 comments

Comments

Projects
None yet
5 participants
@jaredsburrows
Copy link

commented Sep 19, 2017

It seems like the index/home will continue to show all posts. What happens when a user hits 100? 1000? Even as static HTML, it is a lot to load, especially for mobile.

Can we limit each page to like 50 or 100? Could we make it configurable?

@DirtyF

This comment has been minimized.

Copy link
Member

commented Sep 19, 2017

Hi @jaredsburrows

There's an open PR about this: #150

If you have a lot of posts, you should be able to add pagination and override the index.html file of the theme.

If you need pagination on categories or collections, I suggest you take a look on https://github.com/sverrirs/jekyll-paginate-v2 (but it's not supported by GitHub Pages)

@jaredsburrows

This comment has been minimized.

Copy link
Author

commented Sep 20, 2017

@DirtyF Hey, do you have an example project that does work with Github pages? Thanks for the reply by the way.

@DirtyF

This comment has been minimized.

Copy link
Member

commented Sep 21, 2017

@jaredsburrows Posts pagination is supported by default on GitHub Pages, you just have to specify some parameters in your _config.yml:

paginate: 1
paginate_path: "/page/:num/"

Then you loop over paginator.posts instead of site.posts as mentioned in the docs.
Make sure you pagination URLs are properly built, e.g. I had to add relative_url filter to next and previous links.

Here's a basic example with default GitHub Pages theme (primer), it works also for minima:
Pagination demo repository - Pagination basic demo

makietan added a commit to makietan/makietan.github.io that referenced this issue Jun 15, 2018

@begueradj

This comment has been minimized.

Copy link

commented Jul 20, 2018

Without pagination, the default theme is useless when you have lot of posts.

@claudiuconstantin

This comment has been minimized.

Copy link

commented Apr 17, 2019

Whats's the status here? Pagination would be nice for this default theme

@begueradj

This comment has been minimized.

Copy link

commented Apr 17, 2019

Still the same

@prashanthmadi

This comment has been minimized.

Copy link

commented May 28, 2019

Thanks for all great work.. Looking forward for this feature

@prashanthmadi

This comment has been minimized.

Copy link

commented May 28, 2019

I was able to make it work following pull request of @DirtyF . Thanks for help.
https://github.com/prashanthmadi/prashanthmadi.github.io

Commit info : prashanthmadi/prashanthmadi.github.io@d09b435

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.