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

194
Views
Nested dynamic routing getServerSideProps

I'm trying to create dynamic routes for a sitemap in the format [type]/sitemap-[type].xml.js.

As far as I understand from next's docs, the template paths ([type]/[type].js) will be populated by the props you export from getServerSideProps.

However, neither concatenating a string with a template (sitemap-[type].js), nor exporting a separate prop from getServerSideProps will work (see code below).

export async function getServerSideProps(context) {
  const {
    res,
    query: { type },
  } = context;

  ...

  return {
    props: {
      type,
      slug: `sitemap-${type}`,
    },
  };
}

What am I doing wrong? Is getServerSideProps capable of nested dynamic routing for xml files altogether?

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!