-
Notifications
You must be signed in to change notification settings - Fork 181
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
Custom collections with pagination #273
Comments
damiani
changed the title
[Proposal] Custom collections with pagination
Custom collections with pagination
Oct 2, 2018
Any update please? This is urgently needed when generating pages from external JSON provided by API |
What's the status of this? |
Hi there! I would also like to know the status. Hope pagination for categories will be possible soon! |
Hey there, what is the status of this? Is it possible yet? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This came about after not being able to paginate a dynamically-generated collection (original discussion here). I've been recently working on a Jigsaw blog template, and I needed support for paginated index pages for collections created on-the-fly, through an event listener.
In my case, I needed tags/categories. Using @nikazooz's example, I got the tags working but after several attempts it was clear (and @damiani confirmed) that it's currently not possible to paginate such collections.
Although this started from paginating dynamically-generated collections, I think we can take it a step further and think about providing support for 'custom post types', kind of like WordPress does. This would be very compelling for people looking to switch to a static blog, as it would allow them to keep their site's structure.
Here are a few ideas regarding functionality workflow. Let's discuss:
1. Generic
A collection meant for custom types such as tags, should not be opinionated.
Ideally, you want the freedom to display your content/posts grouped in various ways: tags, categories, authors (imagine multi-author posts, and paginated index pages for an author's posts), posts by month, etc.
In this regard, I like @nikazooz's approach. He registers each collection in a class handled in an event.
The best thing about it, from a user perspective, is that you don't need to create files for the collection: no need for a
_tags
folder where each file would define a tag. Instead, you use YAML front matter keys with array values:The helper method on your class then fetches all posts with that front matter key, and builds up the collection (example).
2. Paginated
Of course, any type of collection should allow for pagination.
In this regard, I think the simplest way would be to allow for a
pagination
key on any collection (thus making the current pagination feature obsolete?):With those settings, Jigsaw would paginate our
tags
collection, just like it paginates posts today, so you would get a/tag
folder with a structure like this:This should work even if the collection is generated in an event listener.
Note: there's also #272 which, if implemented, this would need to play nice with.
Looking forward to reading everyone's thoughts on this. Let's discuss :)
The text was updated successfully, but these errors were encountered: