-
-
Notifications
You must be signed in to change notification settings - Fork 493
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
Let me define my own pagination function using JS #772
Comments
@nhoizey I've made year and month collections (see an example here) - you can do it with custom collections. You use a custom collection to create groups of items sliced how you like. You can then pass this collection to pagination to generate the individual pages. I posted the code I use to do this in this thread. |
Oh dang I like this idea. Practically speaking this would allow me to easily add a Day view to my Twitter archive (browse by tweets day) that I really like. |
@edwardhorsford awesome, I'll check that right now! 👍 @zachleat good idea, I also plan to get all my tweets on my site, and daily view will be interesting, because I have quite a few… 😅 |
This repository is now using lodash style issue management for enhancements. This means enhancement issues will now be closed instead of leaving them open. View the enhancement backlog here. Don’t forget to upvote the top comment with 👍! |
(putting this into the queue) |
Is your feature request related to a problem? Please describe.
I really don't like paginations using decimal increments, because every time I add new content, all these pages have changing content, while old archive pages should be really stable, both for SEO and UX (bookmarks for example).
I prefer archives per years and/or months.
Describe the solution you'd like
Being able to define my own JS function to slice the paginated data based on the date would allow that.
A
slice
callback could replace thesize
attribute (I don't see how they could co-exist), and be run after the newbefore
callback.So, instead of spliting
["item1", "item2", "item3", "item4"]
into[["item1", "item2"], ["item3", "item4"]]
(withsize: 2
), it would allow me to split["2018-07-12-article1", "2018-12-13-article2", "2018-12-15-article3", "2019-03-23-article4"]
into this for month pages:I could then (I guess, maybe not) use the date of the first item in each slice to define the
permalink
.Describe alternatives you've considered
The only other I can imagine right now is creating actual templates for each month/year I have published content (quite a lot, since 2001), and filter the content collections for each.
It would be really cumbersome to initialize, and it requires a new page every month.
The text was updated successfully, but these errors were encountered: