Next.js getStaticProps additional params?

601 Views Asked by At

I am wondering if its possible to add additional params inside the getStaticProps function? because I want to query the posts in its category name instead of the category slug so here is what it looks like

export const getStaticPaths: GetStaticPaths = async () => {
  const res = await getAllCategories();

  const paths = res.map((category) => ({
    params: {
      slug: category.slug,
      name: category.name // This is the one I want to add but this is undefined in the getStaticProps
    },
  }));

  return {
    paths,
    fallback: true,
  };
};
0

There are 0 best solutions below