Closed zevi-wiply closed 1 year ago
Hey @zevi-wiply! There are several ways you can avoid/improve this:
How about this as a "yes, and", to prevent duplicate paths ever being selected for pre-render:
const allPaths = allSites
.flatMap(({ subdomain, customDomain }) => [
subdomain &&
!customDomain /* <----- Only include subdomains where there's no customDomain */ && {
domain: `${subdomain}.${process.env.NEXT_PUBLIC_ROOT_DOMAIN}`,
},
customDomain && {
domain: customDomain,
},
])
.filter(Boolean);
Discussed in https://github.com/vercel/platforms/discussions/300
This would mean though that there are two separate static pages, one on the subdomain path and one of the customDomain path that both fetch the exact same site data. I assume it's implemented this way so that we don't need to do any queries in middleware, but isn't it bad practice and a waste of storage having two different sites displaying the same content or am I missing something here?
Any suggestions as to how I could implement custom subdomains and custom domains without generating two separate static pages with the same content?