nodejs.dev icon indicating copy to clipboard operation
nodejs.dev copied to clipboard

Introduce Pagination on the Blog Page

Open ovflowd opened this issue 3 years ago • 1 comments

Summary

Currently, our /blog page doesn't support pagination, hence every single posted post from every category will be shown there.

Since we separate blog posts per category within /blog we could take the approach to show the last 3-4 entries of each category and add a "Show more" button.

We have two opportunities with this button:

  1. Querying GraphQL through a Hook and dynamically rendering the more entries for that category (Always load X more items)
  2. Redirect to the category page for that category (eg.: /blog/{categoryName}) which would show X amount of entries.
  • This would mean that then we would have pagination within the /blog/{categoryName} entry. In other words, some pagination buttons (Page 1, Page 2, Page 3...)
    • Question: Should the buttons show the first previous page link (if exists) and then the current page, and the next 2 pages?
  • The pagination could be done as a query string /blog/{categoryName}?page=X
    • Question: Would this be SEO friendly?
    • An alternative would be /blog/{categoryName}/page/X
      • Would possibly require us to manually register every page on Gatsby (Through a loop/for within the gatsby-nodes.js

Motivation

One of the motivations behind this feature is having an uncluttered blog landing page that shows only the last X posts of every category, allowing then the user to go to the category they wish to see recent or older posts.

cc/ @benhalverson

ovflowd avatar Jul 01 '22 10:07 ovflowd

From a user's standpoint, I think it'd be better to implement both, i.e. show a list of posts from all categories on the '/blog' page and then if user needs to view category specific posts, then inside the '/blog/{respective-category}', we'd have to add pagination to show X number of posts.

Sheharyar566 avatar Jul 28 '22 12:07 Sheharyar566

Hi, I would like to contribute to this issue. I'm going to use pagination component from Figma Design. I will implement second approach and this SEO strategy. Please assign this issue to me.

shlommo avatar Oct 06 '22 18:10 shlommo

Hey @shlommo we do not assign issues here, but feel free to work on the task 😄

ovflowd avatar Oct 06 '22 20:10 ovflowd

Note.: Recent PRs implemented the backend part of pagination.

Pagination itself now is working 👀 we just need to make the Frontend components to make it be actually usable now 🌈

ovflowd avatar Oct 14 '22 20:10 ovflowd

Note.: Recent PRs implemented the backend part of pagination.

Pagination itself now is working 👀 we just need to make the Frontend components to make it be actually usable now 🌈

Oh, what a great news. Thank you 🎉 I already work on it

shlommo avatar Oct 17 '22 04:10 shlommo

Oh, what a great news. Thank you 🎉 I already work on it

Nice! Let me know once you have a PR open 😄

ovflowd avatar Oct 17 '22 09:10 ovflowd

Hey @ovflowd i have a PR for you 👍

shlommo avatar Oct 20 '22 08:10 shlommo

Am I smelling a fresh-opened PR? 👀

ovflowd avatar Oct 20 '22 08:10 ovflowd