feat: blog home pagination and routing#348
Open
Yogi Arif Widodo (yogithesymbian) wants to merge 1 commit intocontentful:mainfrom
Open
feat: blog home pagination and routing#348Yogi Arif Widodo (yogithesymbian) wants to merge 1 commit intocontentful:mainfrom
Yogi Arif Widodo (yogithesymbian) wants to merge 1 commit intocontentful:mainfrom
Conversation
|
Yogi Arif Widodo (@yogithesymbian) is attempting to deploy a commit to the Contentful Apps Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✨ What’s Changed
This PR introduces pagination and route refactor for the blog:
?page=nquery param and GraphQLskiplogic./blog/page.tsx./) from the blog page (/blog) to allow better customization and demonstration of routing versions.🔧 Technical Details
pageBlogPostCollectionGraphQL query withskipandlimitparameters for pagination.page.tsxwithsearchParams.pageto fetch paginated content.BlogPostscomponent using aContainerlayout.useRouter().push()handles?page=nnavigation.🧪 How to Test
/blog.?page=2,?page=3, etc.).PreviousandNextbuttons work and are disabled at page limits./still functions independently and is not affected by this change.🚫 Breaking Changes
/) and blog routes are now structurally separated.📦 Folder Structure Affected
/blog/page.tsx– new structured blog index routelib/fetchPosts.ts– GraphQL logic for paginated fetchcomponents/features/blog/BlogPosts.tsx– blog UI rendering with pagination supportcomponents/ui/Pagination.tsx– reusable pagination UI component✅ Strengths & Highlights
✅ Clean Pagination via Query Parameters (
?page=n)✅ GraphQL Pagination with
skipandlimit✅ Routing Separation (
/blog/page.tsx)/as a clean, standalone landing page./blogto evolve independently as a CMS-powered section.✅ Pagination UI Implementation
useRouter().push()for navigation.❌ 1. No Total Page Count = No Last Page Guard
❌ 2. No Loading State on Pagination Click
🚀 Ideal Starter Use Case
This setup is perfect for developers building a simple blog or documentation site with:
/) for branding, marketing, or announcements./blog) using clean routes and scalable structure.components/,lib/, andapp/blog/.Highlights for starters:
BlogPosts.tsx), card style, or pagination logic.🛠️ Want to turn
/into your landing site and/bloginto a dynamic content hub?→ This is your foundation. Just plug in your CMS and deploy.