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

370
Views
How to write same level slug pages under page in Nuxt js?

I want to route pages depend on incoming url. I have 2 different pages which works like a slug. I need to create my url like in samples. Is there any way to check url params and route them to right slug page inside extendRoutes or somewhere else which will not affect page load speed ?

page
 --_category
 --subcategory

sample url

http://192.168.52.215:3000/news. :category slug
http://192.168.52.215:3000/local-news.   :subcategory slug
extendRoutes(routes, resolve) {
      {
        name: 'category',
        path: '/:category',
        component: resolve('pages/_category.vue'),
      },

      {
        name: 'category',
        path: '/:subcategory',
        component: resolve('pages/subcategory.vue'),
      },
    );

For example , if my paramater includes news, it should go _category slug otherwise it should go to subcategory slug

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you can change name for routes like this

extendRoutes(routes, resolve) {
  {
    name: 'category',
    path: '/:category',
    component: resolve('pages/_category.vue'),
  },
  {
    name: 'subcategory',
    path: '/:subcategory',
    component: resolve('pages/subcategory.vue'),
  }
);

And when you try to navigate do this :

// Navigate to Category Slug
this.$router.push({ name: 'category': params: { category: 'news' } });

// Navigate to Subcategory Slug
this.$router.push({ name: 'subcategory': params: { subcategory: 'local-news' } });
about 4 years ago · Juan Pablo Isaza 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!