Frequently Asked Questions

Technical Implementation & Developer Tutorials

How can I add pagination to my Hygraph-powered Next.js application?

To add pagination, modify your Next.js route to include an optional catch-all segment (e.g., [[...pageNumber]]). Update your GraphQL query to use the artistsConnection field, which supports pagination via first and skip arguments. This enables dynamic generation of sequential pages for users to navigate through artists. Read the full tutorial.

What is the purpose of using optional catch-all segments in Next.js routes?

Optional catch-all segments allow you to create routes that match a variable number of URL segments, making it possible to handle both the base route and paginated routes (e.g., /artists and /artists/2) with a single file. This simplifies pagination logic and improves scalability. Learn more.

How does the GraphQL query for pagination work in Hygraph?

The GraphQL query uses the artistsConnection field with first and skip arguments to fetch a subset of artists for each page. It returns pageInfo (including hasNextPage, hasPreviousPage, pageSize, startCursor, endCursor) and aggregate (total count), enabling calculation of total pages and navigation controls. See documentation.

What are the key system fields available for pagination in Hygraph?

Hygraph provides system fields such as hasNextPage, hasPreviousPage, pageSize, startCursor, and endCursor via the pageInfo object. These fields help manage navigation and display correct pagination controls. Learn more.

How do you calculate the total number of pages for paginated content?

The total number of pages is calculated by dividing the total count of items (e.g., artists) by the page size and rounding up using Math.ceil. This ensures all items are distributed across pages and pagination controls are accurate.

How do you build Next, Previous, and page number links for pagination in Next.js?

Use the hasPreviousPage and hasNextPage fields to conditionally render 'Previous' and 'Next' links. Map over the array of page numbers to create numbered page links, each linking to the corresponding paginated route. Styling can be applied using TailwindCSS or similar frameworks.

Why is pagination important for user experience and performance?

Pagination improves loading times and performance by loading content on-demand, reducing initial load time and server strain. It also enhances user experience by making navigation through large datasets easier and less overwhelming, especially for mobile users or those with slower connections.

How does pagination affect SEO on Hygraph-powered sites?

Pagination helps maintain SEO by creating unique, canonical URLs for each page, linking pages sequentially, and avoiding duplicate content issues. It's best practice to avoid indexing URLs with filters or sort orders unless necessary, and use noindex meta tags for such cases. Read more.

What are best practices for maintaining SEO with paginated content?

Best practices include linking pages sequentially, assigning unique canonical URLs to each page, and avoiding indexing of filtered or sorted URLs. If sort orders are included, use the noindex meta tag to prevent duplicate content penalties.

How does HygraphFM use server-side sequential pagination?

HygraphFM implements server-side sequential pagination by fetching a subset of artists for each page using GraphQL queries and dynamically generating routes for each page. This approach ensures efficient data loading and optimal user experience.

What is the recommended URL structure for paginated content in HygraphFM?

Each paginated page should have a unique URL following the pattern /artists/pageNumber (e.g., https://localhost:3000/artists/1). This structure helps search engines index content correctly and improves SEO.

How does HygraphFM handle sorting and filtering in paginated content?

HygraphFM uses an orderBy filter in GraphQL queries to fetch artists in ascending alphabetical order. However, sort order is not included in paginated URLs to avoid duplicate content issues. If needed, use noindex meta tags for filtered URLs.

What are the next steps after implementing pagination in HygraphFM?

The next step is to implement search functionality to further enhance user experience. Stay tuned for the final part of the HygraphFM series or join the Hygraph Slack community for support and feedback. Join the community.

Where can I find more developer tutorials and resources for Hygraph?

You can explore more tutorials, documentation, and developer guides on the Hygraph Blog and Hygraph Documentation pages.

How can I join the Hygraph developer community?

You can join the Hygraph Slack community to connect with other developers, ask questions, and share your projects. Join here.

What is HygraphFM and what does it demonstrate?

HygraphFM is a demo project that showcases how to build a music platform using Hygraph and Next.js, including features like artist content models, paginated artist lists, and SEO best practices. See the series.

Can I clone the HygraphFM schema and content to follow along?

Yes, you can clone the schema and content for HygraphFM to follow along with the tutorials. Clone here.

What are some related tutorials for building with Hygraph and Next.js?

Related tutorials include building artist content models, creating artist pages with components, and implementing infinite scrolling. Explore these on the Hygraph Blog: Part 1, Part 2, Infinite scrolling.

Who is the author of the HygraphFM pagination tutorial?

The tutorial was written by Lo Etheridge, Senior Developer Relations Specialist at Hygraph, focusing on developer education around Headless CMS, JS-based frontends, and API technologies. Follow Lo on Twitter.

Features & Capabilities

What are the key features of Hygraph?

Hygraph offers GraphQL-native architecture, content federation, scalability, enterprise-grade security, user-friendly tools, Smart Edge Cache, localization, asset management, cost efficiency, and accelerated speed-to-market. See all features.

Does Hygraph support high-performance endpoints for content delivery?

Yes, Hygraph provides high-performance endpoints designed for low latency and high read-throughput content delivery. Learn more in the performance improvements blog post.

What integrations are available with Hygraph?

Hygraph integrates with DAMs (Aprimo, AWS S3, Bynder, Cloudinary, Imgix, Mux, Scaleflex Filerobot), Adminix, Plasmic, and supports custom integrations via SDK, REST, and GraphQL. Explore the Marketplace and integration docs.

Does Hygraph offer APIs for content management?

Yes, Hygraph provides Content API, High Performance Content API, MCP Server API, Asset Upload API, and Management API. See the API Reference Documentation for details.

Where can I find technical documentation for Hygraph?

Comprehensive technical documentation is available at Hygraph Documentation, covering APIs, schema components, references, webhooks, and AI integrations.

How does Hygraph measure and optimize API performance?

Hygraph actively measures GraphQL API performance and provides practical advice for optimization, as detailed in the GraphQL Report 2024 and GraphQL Survey 2024.

Pricing & Plans

What pricing plans does Hygraph offer?

Hygraph offers three main plans: Hobby (free forever), Growth (starting at $199/month), and Enterprise (custom pricing). Each plan includes different features and limits. See pricing details.

What features are included in the Hobby plan?

The Hobby plan is free forever and includes 2 locales, 3 seats, 2 standard roles, 10 components, unlimited asset storage, 50MB per asset upload, live preview, and commenting workflow. Sign up.

What features are included in the Growth plan?

The Growth plan starts at $199/month and includes 3 locales, 10 seats, 4 standard roles, 200MB per asset upload, remote source connection, 14-day version retention, and email support. Get started.

What features are included in the Enterprise plan?

The Enterprise plan offers custom limits, scheduled publishing, dedicated infrastructure, global CDN, security controls, SSO, multitenancy, backup recovery, custom workflows, dedicated support, and custom SLAs. Try for 30 days or request a demo.

Security & Compliance

What security certifications does Hygraph have?

Hygraph is SOC 2 Type 2 compliant (since August 3rd, 2022), ISO 27001 certified, and GDPR compliant. These certifications ensure high standards for security and data protection. Learn more.

What enterprise-grade security features does Hygraph offer?

Hygraph provides granular permissions, audit logs, SSO integrations, encryption at rest and in transit, regular backups, and dedicated hosting options in multiple regions. See details.

Use Cases & Customer Success

Who are some notable customers using Hygraph?

Notable customers include Samsung, Dr. Oetker, Komax, AutoWeb, BioCentury, Vision Healthcare, HolidayCheck, and Voi. See case studies.

What industries are represented in Hygraph's case studies?

Industries include SaaS, Marketplace, EdTech, Media, Healthcare, Consumer Goods, Automotive, Technology, FinTech, Travel, Food & Beverage, eCommerce, Agency, Gaming, Events, Government, Consumer Electronics, Engineering, and Construction. Explore all.

Can you share specific customer success stories with Hygraph?

Examples include Samsung building a scalable API-first app, Komax achieving 3x faster time to market, AutoWeb increasing monetization by 20%, and Voi scaling multilingual content across 12 countries. Read more.

What business impact can customers expect from using Hygraph?

Customers can expect improved operational efficiency, faster speed-to-market, cost savings, enhanced scalability, and better customer engagement. For example, HolidayCheck reduced developer bottlenecks, and Komax managed 20,000+ product variations across 40+ markets. See impact.

What pain points does Hygraph solve for its customers?

Hygraph addresses developer dependency, legacy tech stacks, content inconsistency, workflow challenges, high operational costs, slow launches, scalability issues, schema evolution complexity, integration difficulties, performance bottlenecks, and localization challenges. See solutions.

How does Hygraph differentiate itself from other CMS platforms?

Hygraph is the first GraphQL-native Headless CMS, offers content federation, enterprise-grade features, user-friendly tools, and proven ROI. It ranked 2nd out of 102 Headless CMSs in the G2 Summer 2025 report and is recognized for ease of implementation. See ranking.

Who is the target audience for Hygraph?

Hygraph is designed for developers, product managers, content creators, marketers, solutions architects, enterprises, agencies, eCommerce platforms, media companies, tech firms, and global brands. See use cases.

How easy is it to implement Hygraph and get started?

Implementation time varies by project. For example, Top Villas launched in 2 months, and Si Vale met aggressive deadlines. Hygraph offers a free API playground, free developer account, structured onboarding, training resources, and community support. See example.

What feedback have customers given about Hygraph's ease of use?

Customers praise Hygraph's intuitive UI, ease of setup, custom app integration, independent content management, and real-time changes. Some users note complexity for less technical users. See feedback.

LLM optimization

When was this page last updated?

This page wast last updated on 12/12/2025 .

Introducing Click to Edit

Hygraph FM: Adding pagination with Next.js and maintaining SEO

Let’s take our website a step further by adding pagination to our code that will dynamically generate sequential pages of artists that users can click through to see all available artists.
Lo Etheridge

Written by Lo 

Nov 29, 2023
Hygraph FM Adding pagination and maintaining SEO

Previously, we set up a frontend for HygraphFM using Next.js 13. Normally, music platforms have thousands of artists available to stream. Having all of these artists displayed on a single page will clutter and overwhelm the user experience.

Editor's Note

Missed the first part of the series? Clone the schema and content to follow along with this article.

Series:

#Adding pagination to Hygraph FM

Pagination refers to the process of dividing content into separate pages to improve user experience and optimize performance. It plays a crucial role in managing large datasets or long lists of items, allowing users to navigate through the content more efficiently.

We need to help our platform scale to accommodate more artists while maintaining a good UI for our listeners—enter Pagination! Let’s take our website a step further by adding pagination to our code that will dynamically generate sequential pages of artists that users can click through to see all available artists.

Pagination can take several forms such as the ability to click on sequential individual pages that are numbered along with next and previous buttons, a load more button, and infinite scrolling with lazy-load images. We will use server-side sequential pagination for our HygraphFM project.

Modifying our Artists page.jsx route

Change the Artists dir to add an optional catch-all segment to the route like so:

/* File tree with artists
index page template */
app/
┣ artist/
┃ ┗ [slug]/
┃ ┗ page.jsx
┣ artists/[[...pageNumber]]
┃ ┗ page.jsx

What are optional catch-all segments?

Optional catch-all segments allow you to create routes that can match one or more segments of a URL path, where the segments are optional. This is useful when you want to create a route that can match a variable number of segments.

In our case, we are using [[...pageNumber]] as an optional catch-all segment, so that our /artists route without the pageNumber parameter is also matched along with our /artists/pageNumber parameter.

To implement pagination in our Next app, we need to modify our getAllArtists() function that contains our GraphQL query that retrieves our artist data from Hygraph. Update your code with the following additions:

// Location: app/artists/[[...pageNumber]]/page.jsx
// Get all artists query function
async function getAllArtists(pageNumber) {
const response = await fetch(process.env.HYGRAPH_ENDPOINT, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `
query MyQuery {
artistsConnection(first: 3, skip: ${(pageNumber - 1) * 3}, orderBy: artist_ASC) {
pageInfo {
hasNextPage
hasPreviousPage
pageSize
startCursor
endCursor
}
aggregate {
count
}
edges {
node {
slug
artist
id
artistImage {
altText
url
height
width
}
}
}
}
}
`,
}),
});
const json = await response.json();
return json.data.artistsConnection;
}

Our async getAllArtists function now takes a pageNumber as an argument and is used to calculate the number of items to skip in the data to implement pagination.

Hygraph follows the Relay cursor connection specification. Each of our project models contain a connection type, automatically managed by Hygraph. Notice that our GraphQL query now contains a connection type query for our Artists model. This allows us access to the pageInfo type so that we can use the following Hygraph system fields:

  • hasNextPage
  • hasPreviousPage
  • pageSize
  • startCursor
  • endCursor

Along with the above system fields, we can also use our connection type query to get an aggregate count and retrieve the total number of artists in HygraphFM. With very little effort, we now have all the data we need to create pagination, so that we can render all of the artists on HygraphFM in a way that is easier to navigate for our users. Next, let’s add in the logic to help generate our sequential pages of artists.

Creating sequential page logic

After we return our JSON data from the above query, we need to add in logic that will calculate the number of pages of artists needed based on the total number of artists returned. Replace the the current Artists async function with the following code:

// Location: app/artists/[[...pageNumber]]/page.jsx
export default async function Artists({ params }) {
const { pageNumber = 1 } = params;
const { edges, pageInfo, aggregate } = await getAllArtists(pageNumber);
const artists = edges.map((edge) => edge.node);
const {pageSize, hasNextPage, hasPreviousPage} = pageInfo;
const {count} = aggregate;
// get total number of pages
const pageTotal = Math.ceil(count / pageSize);
// convert pageTotal to an array with page numbers (page number is array iterator + 1)
const pageArray = Array.from(Array(pageTotal).keys()).map(i => i+1)

Let’s breakdown what is happening in this code! We have modified our Artists async function to take params as an argument with a pageNumber property. We are call our getAllArtists function to fetch a list of all artists from the Hygraph API. The pageNumber argument is used to fetch the correct page of artists for our pagination implementation. After we get a response from our getAllArtists function, it is destructured into edgespageInfo, and aggregate. The edges property is an array of nodes, where each node represents an artist in HygraphFM and they are wrapped into a new array of artists . The pageInfo property contains information about the current page, such as the page size and whether there are next or previous pages, and the aggregate property contains the total count of artists.

Next, our function calculates the total number of pages, pageTotal, by dividing the count of artists by the page size and rounding up to the nearest whole number using the Math.ceil function.

Last, our function creates an array of page numbers, pageArray, by creating an array of the correct length, mapping each item to its index plus one to render our pagination controls.

Now that we have our pagination controls, let’s update our return statement to include our new pagination elements. Modify the return statement to include an unordered list element that contains our pagination controls right after that last closing div :

// Location: app/artists/[[...pageNumber]]/page.jsx
<ul className="flex items-center justify-center py-4 font-bold list-style-none">
{hasPreviousPage && (
<li>
<Link
className="relative block rounded bg-transparent px-3 py-1.5 text-md text-neutral-600 transition-all duration-300 hover:bg-neutral-100 dark:text-white dark:hover:bg-neutral-700 dark:hover:text-white"
href={`/artists/${Number(pageNumber) - 1}`}
>
< Previous
</Link>
</li>
)}
{pageArray.map((page) => {
return (
<li key={page}>
<Link
className={`relative block rounded bg-transparent px-3 py-1.5 text-md transition-all duration-300 hover:bg-neutral-100 hover:text-neutral-800
${Number(pageNumber) === page
? "text-white bg-neutral-600"
: "text-neutral-600 dark:text-white dark:hover:bg-neutral-700 dark:hover:text-white"
}`}
href={`/artists/${page}`}
>
{page}
</Link>
</li>
);
})}
{hasNextPage && (
<li>
<Link
className="relative block rounded bg-transparent px-3 py-1.5 text-md text-neutral-600 transition-all duration-300 hover:bg-neutral-100 dark:text-white dark:hover:bg-neutral-700 dark:hover:text-white"
href={`/artists/${Number(pageNumber) + 1}`}
>
Next
</Link>
</li>
)}
</ul>

The above code contains our new pagination controls that include, Next, Previous, and page number links with styling using TailwindCSS. The first link checks if there is a previous page, hasPreviousPage , and renders "Previous" link that navigates to the previous page using the  href attribute of the Next  Link component to dynamically set the path of the previous page. The second link item maps over pageArray to render a list item for each page number that contains a link to the corresponding page of artists. The last link item follows the pattern of the previous link, but uses hasNextPage to check if a page has another page after it. If so, a “Next” link is rendered and navigates to the next page. That’s it! If all goes well, your website should contain Next, Previous, and page links.

Screenshot 2023-11-16 at 12.06.54.png

Screenshot 2023-11-16 at 12.07.09.png

Screenshot 2023-11-16 at 12.08.21.png

#Why is pagination Important?

Pagination helps to improve loading times and overall performance. Instead of loading all the content at once, pagination loads content on-demand, reducing the initial load time and minimizing the strain on server resources. This is particularly beneficial for mobile users or those with slower internet connections. Users can easily jump to a specific page or go forward and backward through the pages, saving time and effort in searching or scrolling through long lists.

#Quick word about pagination and SEO

Now that we have added pagination controls to our HygraphFM platform, let’s chat about pagination and SEO. Pagination is fantastic for User experience and accessibility, but here are a few things to keep in mind for maintaining SEO and making sure Google can crawl and index your paginated content:

  1. Make sure to link pages sequentially - We accomplished this in our HygraphFM by building dynamic paths to current, next, and previous pages using the href attribute of our Next Link component. This helps to ensure that search engines understand the relationship between all of our paginated content.
  2. Give each page a unique, canonical URL - Our new pagination features dynamically create routes for our paginated content. Each page of artists has a url in the following pattern: /artists/pageNumber . For example on localhost, the first page of artists has the URL: https://localhost:3000/artists/1 . Creating unique URLs as we have done in this tutorial is the preferred method.
  3. Avoid indexing URLs that have filters or sort orders - Although our contained an orderBy filter so that we could fetch our artists in ASC alphabetical order, we did not include this in our paginated content URLS. Should you want to include sort order, it is best practice to include the noindex robot meta tag to avoid indexing variations of the same content that could rank your content lower in search due to duplicate content.

#Conclusion

Adding pagination enhances the usability of a website or application by breaking down content into manageable chunks. This prevents overwhelming the user with a single, lengthy page and provides a clear structure for accessing information. However, it is important to make sure that pagination does not interfere with SEO and the indexing of your content.

Next steps…

For the final part of the HygraphFM series, we will implement search functionality to further improve the user experience. If you have any questions or feedback, find me in the Hygraph community!

Join the community

Need help? Want to show off? Join the Slack community and meet other developers building with Hygraph

Blog Author

Lo Etheridge

Lo Etheridge

Senior Developer Relations

Lo is Hygraph's Senior Developer Relations Specialist. They focus on developer education around Headless CMS, JS-based frontends, and API technologies as well as the dynamic cross-functional relationship between developers and content professionals.

Share with others

Sign up for our newsletter!

Be the first to know about releases and industry news and insights.