Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pagination to the tags page #869

Open
Adriel-M opened this issue Mar 10, 2024 · 3 comments
Open

Add pagination to the tags page #869

Adriel-M opened this issue Mar 10, 2024 · 3 comments

Comments

@Adriel-M
Copy link

Since the blog page has pagination, the tags should also paginate to keep the same functionality in that page.

I did something similar to my site: Adriel-M/adriel.dev#80 (no demo on my actual site since I don't have enough posts 馃槗 )

I had to:

  1. Create app/tags/[tag]/page/[page]/page.tsx to support the paging.
  2. Create a component layouts/PagedListLayoutWithTags.tsx that just populates the right fields to ListLayout
  3. Modify ListLayoutWithTags.tsx to handle finding out current tag and the base path since there's multiple levels now.

Let me know if this is something wanted and I can try sending a PR

@ray-android
Copy link

Thanks for raising this issue.
Previously, someone raised a similar question #190 and I tried to adapt the existing code but to no avail.

Your code seems ok to me except the pagination is in decimal points which resulted in the last page not being able to show. I have fixed it by including Math.ceil in the return code for the getTotalPages function.

@Adriel-M
Copy link
Author

Ah good catch.

Thanks!

@PxlSyl
Copy link
Contributor

PxlSyl commented Apr 25, 2024

Hi! I made a similar proposal a few months ago for my i18n version. And I finally just got to work and so I coded it! Being an i18n version, this requires some adaptations for the normal version, but in any case it works :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants