Search code examples
routessubdomainnuxt.jsvue-router

Handling subdomains with nuxtJS


I'm having a site, let's say example.com which shares the layout and few components with subdomain blog.example.com so i want to create common nuxtJS project for this so that the routes and all things will be optimized by nuxtJS, i don't want to create 2 projects for this as there would be repetition of components, how can i achieve this result?


Solution

  • I achieved the result by filtering the routes to remove and then removing the folder name the path and route name, with @nuxtjs/router module, and for simplicity I've created my own module to do the exact same with user friendly interface, have a look at k-domains npm module. Here's the link to the articlehandle multiple subdomains in nuxtJS project