Open ErickPetru opened 3 years ago
From my understanding, I guess you want to have shared folders across multiples subdomains?
let's say you have 2 subdomains bestshoes
and foodsite
so your config file looks like this:
export default {
buildModules: [
[ "k-domains", {
subDomains: ["bestshoes", "foodsite" ],
rootDomain: "root-domain"
}]
]
}
but even in this case, if you create a folder at pages
and without adding it to the subdomains option in nuxt.config
, it will be automatically mapped to all the subdomains.
consider this is your pages tree
|
|─pages
| ├───bestshoes
| ├───foodsite
| ├───root-domain
| └───store // not added in the config file
| ├───index.vue
| └───offer.vue
so even in this version, the shared
will be accessible from all the domains
all the following will work:
bestshoes.myplatform.com/store
bestshoes.myplatform.com/store/offer
foodsite.myplatform.com/store
foodsite.myplatform.com/store/offer
and for getting the current subdomain, so yes I will add it in future releases, I'll export a variable for the current subdomain.
Hi @madhusudanbabar, thanks for your reply. I think we're almost on it but not yet.
The deal is that I don't want a "store" route. The desired URLs would be:
bestshoes.myplatform.com
(index of the bestshoes e-commerce).bestshoes.myplatform.com/cart
(cart of bestshoes e-commerce).foodsite.myplatform.com
(index of the foodsite e-commerce).foodsite.myplatform.com/cart
(cart of foodsite e-commerce).I understand that I could put all those routes directly on pages
folder and all would be available for every subdomain. But I can't do that, because the www.myplatform.com
is the landing page of the platform and were the users create their own subdomains and configure it, so there would be files for the platform itself, not for each store. Can I have all store
files mapped to each subdomain but not as a route of the subdomain?
Also, there are another deal: the names and the number of subdomains is unknow. A new user could arrive at the platform landing page and create a new account, registering a custom subdomain for their needs. So, is it possible to update on-the-fly the subDomains
property on nuxt.config.js
?
sorry for the late reply,
yes, I got it now, so in short, we've to map some folders to only selected subdomains with or w/o changing the route path, I mean including the store
in the path or omitting it, both things are possible, I'll give it a try very soon, thanks
是的,我也想要通过 * 泛域名指向pages里不同的文件夹
I also have the same problem, its like a blog site, where my clients can choose different subdomain they want. can we use this module in that purpose? or only have static use case?
Came here looking to have *.domain.com go to something like /pages/_subdomain.vue
- is this at all possible?
@madhusudanbabar was the variable for exposing current subdomain ever added?
First of all, nice work done with this package.
Now, imagine this use case:
bestshoes.myplatform.com
orfoodsite.myplatform.com
. And for sure we'd need to be able to get the current subdomain to use it as a param form API requests, so we can get the right data for each store.Is it possible right now? Or is it even viable with some work in this module code?