-
-
Notifications
You must be signed in to change notification settings - Fork 487
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
Example on how to achieve pagination #345
Comments
Can you include your pagination template code here and I help specifically with your problem? |
Hi @zachleat! I was trying out myself but i couldn't make it work so I removed it. Here's the code and the page: code: https://github.com/ajmalafif/ajmalafif.design/blob/master/_includes/layouts/blog.njk So I haven't import all contents from https://blog.ajmalafif.com but the idea is to paginate the blog page to have 5 posts per page. I was just approaching it through trial-and-error but couldn't figure out myself. |
The pagination docs offer an example that might apply here:
Using the new 0.6.0 features in pagination you should be able to do your paging sample too:
Specifically using a combination of the page number and the hrefs array / firstPageLink lastPagelink etc. |
Hi @Vassi, appreciate the help! I did give above a try but it doesn't work. Maybe I apply it wrongly. I am guessing this code here goes to
But where do I put this code tho?
Thanks again! |
The second bit is what's inside the pagination variable. So today you have this in your layout:
I would move the last two lines to your blog.md page (since it uses your layout) and maybe try:
I omitted the set because the alias should already be creating the postslist variable your component wants disclaimer: I don't have the ability to test this right now, just trying to help! |
Hi @Vassi, Thanks for the suggestion, but it still doesn't work. No worries though, I think maybe Eleventy actually don't support this because I actually never see any paginations on other eleventy's website. We'll figure this out next year! Happy holidays and thanks so much for the suggestion! |
I just realized there's no code for something like |
This is not a good resolution. I'm starting a new issue. |
@freshyill hey i reopen the issue and somehow, I just tweeted about this and Eleventy's twitter replied as well: https://twitter.com/ajmalafif/status/1107657182621777926 |
Howdy y’all, I made a dedicated documentation page just for this, please have a look! https://www.11ty.dev/docs/pagination/nav/ (link edited) |
this link is bad. |
That's because it moved to https://www.11ty.io/docs/pagination/nav/ by now. |
how to get get the total number of pages?? |
@clockshark in upcoming v0.10.0 you can use |
I have tried searching through the docs and github issues and apply them all, and none of it working for me.
I think I am missing something substantial here. I'll looking to apply this kind of pagination for my blogpost:
image credit to: https://dribbble.com/shots/2351417-What-s-your-fav-pagination/attachments/449743
I am using this boilerplate as my starting point: https://github.com/danurbanowicz/eleventy-netlify-boilerplate
My suspicion is I can't use
- post
as my tag since it's already been used? I plan to write a tutorial for this for non-technical users of 11ty (I am a designer) after I figure this out because it's way too painful to do this with 11ty.The text was updated successfully, but these errors were encountered: