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

324
Views
How to write Dynamic Pages for complex Urls in Nuxt js?

I use one page to show details of categories and sub-categories. I do not use router.js to override it and I wanna use nuxt dynamic pages to solve this issue.

url: "/news/afghanistan-81291"

url:"/gallery/technology/apple-revenue-81260"

url:"/world/economy/turkey-economy-81260"

my localhost url should be look like (page-name/category/:subcategory?)

http://localhost:3000/detail/news/afghanistan-81291

http://localhost:3000/detail/gallery/technology/apple-revenue-81265

http://localhost:3000/detail/world/economy/turkey-economy-81240

in .nuxt router js

{
  path: "/detail", 
  name: "detail",
  children: [{
    path: "category/:subcategory", 
    name: "detail-category-subcategory"
  },
  ...
}

this does not look like a good practice and I need best practice.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You could use this kind of structure inside of your pages

- detail
-- - news
-- -- - _slug.vue
-- -- gallery
-- -- -- _tech
-- -- -- -- _slug.vue
-- -- world
-- -- -- _category
-- -- -- -- _slug.vue

You will not need to get out of your pages and could handle everything inside of a single place (and close to your code).

More context from the documentation available here.


Here is another answer on how to keep things flexible while still staying in your .vue components.

over 4 years ago · Santiago Trujillo Report

0

extendroutes solved this problem

  extendRoutes(routes, resolve) {
    routes.push({
      name: 'detailed-category',
      path: '/detail/:categoryType/:subCategoryType?/:title',
      component: resolve('pages/detail.vue'),
    });
  },
over 4 years ago · Santiago Trujillo Report
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!