Linked Questions

Popular Questions

How to create dynamic url / subdomain in vue.js?

Asked by At

I am trying to improve the SEO on my website and I got the tip to create dynamic urls/subdomains.

So if a person searches for CRM on our website then the result page will show results of CRM companies and if someone searches for accounting systems then the result will show accounting systems.

Now how can I change the URLs so that the URL says www.ourwebsite.com/result/crm or www.ourwebsite.com/result/accounting depending on what they search?

My router.js is fairly straight-forward:

    import Vue from 'vue'
    import VueRouter from 'vue-router'
    
    Vue.use(VueRouter)
    
    const routes = [
      {
        path: '/',
        name: 'explore_page',
        component: () => import(/* webpackChunkName: "about" */ '../views/explore_page.vue')
      },
      {
        path: '/result',
        name: 'result',
        component: () => import(/* webpackChunkName: "about" */ '../views/resultpage.vue'),
      
      }
    ]

The code to get to the result page from the explore_page is:

router.push({ path:"result", query:{search_id:search_id}})

Do I need to do changes in the router.push({}) code or in the router.js?
I am a bit lost on what to search for so any help in the right direction would be very nice.
Thanks

Related Questions