Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

609
Views
Can't access multiple parameters of getStaticPaths from getStaticProps , Nextjs/Apollo/Graphql

Below you can check the code. I'm trying to use Id to identify single content and use titles for links,

when I console log params.title

console: android-paging-advanced-codelab

but

when I try to console log params.id,

console: undefined

I need to access both params inside the getStaticProps so I can use the exact data I need.

I did try context by passing context and using context.params.id but the result is the same.

read the code below and help me, please!

Here you can see the code of my getStaticPaths :

export async function getStaticPaths(){

  const { data } = await client.query({
    query: gql`
    query {
      postContents{
        data{
          attributes{
              post_card{
                data{
                  id
                  attributes{
                    TitleForLink
                  }
                }
              }
          }
        }
      }
    }
    `
  })
  
  const paths = data.postContents.data.map((item)=> {
    return {
      params: { 
        id: item.attributes.post_card.data.id.toString(), 
        title: item.attributes.post_card.data.attributes.TitleForLink.toString(), 
      }
    }
  })

  return {
    paths,
    fallback: false,
  }

}

And the code of getStaticProps:

export async function getStaticProps({params}){
 
  const { data } = await client.query({
    query: gql`
    query {
      postCards{
        data{
          id
          attributes{
            post_content{
              data{
                id
                attributes{
                  Title
                  Description
                }
              }
            }
          }
        }
      }
    }
    `
  })
  console.log(params.id)
  return {
    props: {
      content: data.postCards.data,
    }
  }
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!