Example of blog index pagination
See original GitHub issueHi we are having a huge amount of blogs to list on our website and we want to implement pagination for the index page, Are there any best practices for Elderjs. What direction should I take, is there any plugin that could be used for this. We want a total of 20 blogs to be shown on 1 page and assuming we have more than 200 blogs that would need 10 different pages. Ideally, the route should look like <domain>/blog/
to <domain>/blog/10
.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
How to add pagination to blog posts index - UsableWP
Now, if you go to the “Blog” page in the browser, the blog posts index shows only 3 posts out of 8 posts...
Read more >WordPress Pagination: How to Add Pagination Manually or ...
WordPress pagination is the process of splitting the list of your website's blog posts or other content into separate pages.
Read more >Pagination | Jekyll • Simple, blog-aware, static sites
If a site has 12 posts and specifies paginate: 5 , Jekyll will write blog/index.html with the first 5 posts, blog/page2/index.html with the...
Read more >Pagination Best Practices for Google | Documentation
Learn best practices for indexing your ecommerce site when using pagination and incremental page loading and how this can impact Google Search.
Read more >SEO-Friendly Pagination: A Complete Best Practices Guide
In this guide, learn how pagination can hurt SEO, the pros and cons of pagination handling options, and how to track KPIs.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is my workaround to get blog pagination which is kinda hacky, it will generate
blog
as the first pageblog/2
as the second page and so on.also i publish this as a elderjs plugin elderjs-plugin-blog-pagination to reduce code you need to copy.
And in my BlogIndex.svelte
And for Pagination.svelte
Stepping back a level, your
all
object is going to need to go through the count of blog posts and generate a request for each page. Basically, you’d return something like:Then, your permalink function would generate a link for each route:
This will give you
/blog
/,/blog/1/
,/blog/2/
, etc. Then, yourdata
section would slice the array of posts based on the page passed in from the request.Hopefully this helps you get started, I know it’s pretty high level. I’m working on something similar for my own website, including tag and month archives with their own pagination. I’m planning to put together a more detailed writeup when it’s done.