Posts pagination #4
Comments
@kbariotis yes it is. I have to do some testing, not quite sure yet how that will work but it'll be addressed soon. |
Yes its tricky but super useful. Things to consider:
Let me know what you think and if I could help you on that. |
Thanks for all that information. I'll check Phenomic solution in deep, seems pretty interesting. But this is topic for pagination. I will try to find out some time later this week to play with some possible solutions taking aside configuration by now. I'm more than open to suggestions, so if you have the time and want to contribute I'd love to evaluate alternatives! Thanks a lot! |
Here is how I implemented pagination. It may give you inspiration for something more complex. Wrap your page with both const currentData = post.data;
const currentIndex = posts.findIndex(post => currentData.url === post.data.url); Import a component like such: const PagionationLink = ({ direction, post }) => {
if (post) {
return (
<div>
<div>{direction}</div>
<div>
<NexteinLink {...post}>
<a>{post.data.title}</a>
</NexteinLink>
</div>
</div>
);
} else {
return <div />;
}
}; Then pass props to it like such: <PaginationLink direction="Previous" post={posts[currentIndex - 1]} />
<PaginationLink direction="Next" post={posts[currentIndex + 1]} /> If there's no post at the previous or next index, it returns blank. Otherwise it renders. |
Is pagination for posts on your plans? It would be a great feature to have.
The text was updated successfully, but these errors were encountered: