Questions tagged [nextjs-dynamic-routing]

In Next.js, dynamic routes are defined by placing the parameter inside square brackets ([]) in the page file name. For example, if you have a dynamic route for displaying a user's profile, you can create a file called [username].js. The username inside the brackets is the parameter that will be used to generate dynamic pages.

To handle dynamic routes, Next.js provides a special component called getServerSideProps or getStaticProps. These functions allow you to fetch data based on the dynamic parameter and pass it as props to the page component.

188 questions
0
votes
1 answer

context parameter is empty on getServerSideProps when page refresh

In one of my projects, I need to fill the meta keyword and the meta description by the data which is fetched from a REST API request. so I used the getServerSideProps function, to fetch the response and pass it to the page. Here's my…
0
votes
1 answer

NextJS: unable to set title with dynamic routes

I am not able to set title and others meta tags on a page created with dynamic routes. Title and metas are set correctly when the page is loaded in the browser, but they are not set in the raw HTML code I fetch using wget. I have tried using both…
Fabio Rotondo
  • 390
  • 2
  • 10
0
votes
1 answer

Conditional redirect based on referrer

Is it possible to conditionally redirect based on the referrer of the visitor? What I want to do is redirecting the user if it comes from a specific domain (and/or any other subdomains), if there is no referrer or the domain does not match, no…
FFF
  • 13
  • 7
0
votes
0 answers

value is missing query values to be interpolated properly event provide in nextjs

I go to url http://local:3000/customize/collection/doremon1234a/schema/dfs/template/50 Enven I provide [colName - doremon1234a], [schemaName - dfs], [templateId - 50] But it still gets errors I try to remove .next folder, and clone source code…
sun1211
  • 1,219
  • 10
  • 15
0
votes
0 answers

How to setup parametrized next routing w/o server-side rendering?

I am trying to set up the routing with my next.js configuration. Whatever I tried so far did not produce the intended results. This is becoming confusing and frustrating for me, any help will be appreciated. Here is what I want: url goes to / =>…
fatih
  • 1,010
  • 1
  • 8
  • 20
0
votes
1 answer

changing the URL in next j s is not working properly

i am currently working on next j s routing and i am passing multiple parameters in URL and i want hide those parameters and just want to show some text i am passing parameters in router as Router.push({path name:"/Home/about/"+id…
0
votes
2 answers

Any way to get url params in Next.js custom document?

I'm working on a multi-language statically built (next export) Next.js site. I can't use next internationalization so I've had to hack together a solution, mostly based on this nextjs-18n-static-page-starter My page structure looks like this: pages …
0
votes
1 answer

NextJS How to create dynamic backend routes

Is there away for me to create dynamic backend routes? I am creating and image host. I am wanting the user to be able to get their image saved on the server under a domain like this http://localhost/ and example of the link would be…
Tyrao
  • 41
  • 1
  • 1
  • 6
0
votes
1 answer

Hello, i use NextJs and i need to achieve url like page/[id]/[slug] from page

I need to take the data as I had on the/[id] page, but in the URL I want to have the/[id]/[slug] page. Can I do this, and if I can, how?
Sah9
  • 49
  • 4
0
votes
2 answers

Next js component doesn't show without reload

Basically, I have a nested component that I want to render with the parent component and it's working fine when the server starts. But the problem arises when I switch back from another page. Some of the nested components get disappeared. If I made…
0
votes
1 answer

Conditional Redirects in NextJS

Context: I have a blog with a good amount of content indexed by Google. For example, all the content is indexed as www.site.com/post1. I am migrating my blog to NextJS and I have scoped the blog posts to www.site.com/blog/post1. I was able to easily…
Shrikar
  • 840
  • 1
  • 8
  • 30
0
votes
0 answers

Nextjs page not revalidating

On my website, I have [articleKey].tsx page, where I download current articles from the backend and show them on the screen. export async function getStaticProps({locale, req, res}) { const articles = await requestArticles({lang: locale}) …
MarcinM
  • 428
  • 7
  • 15
0
votes
1 answer

Is it possible to create a large array of rewrites in NextJS at build time?

I have a lot of reference to my site I'm migrating to NextJS that start with capital letters like this: https://svcc.mobi/Presenter/2019/llewellyn-falco-3133 (notice the capital P in Presenter) I want them all to rewrite…
Peter Kellner
  • 14,748
  • 25
  • 102
  • 188
0
votes
1 answer

Next.js: How do you pass data to a route created dynamically

I have a component that is receiving data: const ProductTile = ({ data }) => { let { productList } = data var [products] = productList var { products } = products; return (
Antonio Pavicevac-Ortiz
  • 7,239
  • 17
  • 68
  • 141
-1
votes
0 answers

How to make CRUD in MongoDB, Express, NextJs(13 or latest)

Can someone provide me an example please. I am a newbie and I want to learn. I've seen a lot of CRUD using NEXT13 but I CAN'T FIND ANY, that SEPARATED THE BACKEND (EXPRESS) from FRONTEND (NEXTJS) I do really appreciate your help and hope someone…
eric
  • 1
1 2 3
12
13