I use Nuxt composition api in my project. I have 1 detail page and 2 different url comes from my API. I don't want to create different detail pages for every url. I use extendRoutes in my project and I need to solve this issue.
urls
/sport/asian-football-3581. -> sub category + news title
/video/world/mama-dog-rubble-in-india-3581246. -> category + subcategory + news title
router.js
extendRoutes(routes, resolve) {
routes.push(
{
name: 'detail',
path: '/:subCategory/:title(.*)-:id([0-9]+)',
component: resolve('pages/detail.vue'),
},
path: '/:subCategory/:title(.*)-:id([0-9]+)',
path: '/:category/:subCategory/:title(.*)-:id([0-9]+)',
Paths can come with these two types. I want to route them to same detail page. And I need to catch subCategory, title, id and if it has category params also. In my solution, if second path comes, I cant catch parameters true