Duplicate page name and content for same route on multi-tenant app

Hey i have a next JS app in pages router, planning to deploy it on vercel itself, its a multi-tenant blog app and i have a few questions.

I have 2 main routes where SEO is super curial and these pages have to get ranked and the content has to be inside the page source HTML, on the /blogs and /blogs/[…slug].js route

I’m planning to use ISR but have a doubt what if 2 of my tenants lets say google and facebook have a same route for example blogs.google.com/blogs/getting-started as well as blogs.facebook.com/bogs/getting-started

then how will vercel’s cache know which content has to be served on which route and the same for /blogs as well coz both are same for example blogs.google.com/blogs and facabook.com ← now here /blogs is same and so is /blogs/getting-started

ALSO i will be pre-generating all pages for better load times and SEO, so in my getStaticPaths fn I’ll be having a fn which calls the backend, and fetches all pages and creates an array of those available routes. then how will verel identify that on /blogs of google it has to serve google’s content and on /blogs of facbook it has to serve facebook’s content? So yeah how do i exactly structure my getStaticPaths and getStaticPropsor if apart from these 2 getStaticPaths and getStaticProps there are any better/ideal fns which i should be using

NOTE - Iooking at - Platforms Starter Kit i’ve already added my domin and even added a wildcard in front of it as *.cypherscrive.com and i will ask my tenants to add my c-name into theirs for the subdomain for example once somebody signs up and starts paying i assign them a subdomain like lets say

google.cypherscribe.com → which is a result of *.cypherscribe.com and once they add my c-name into their thing it will point blogs.google.com/blogs and subsequent related routes to google.cypherscribe.com
Can somebody please help me with those questions as well as help me craft the perfect getStaticPaths and getStaticProps Fn for it

Hey! Happy to help out.

Each of the tenants mentioned would have different subdomains, and those page responses would be cached different on Vercel’s Edge Network. So, using ISR should work well here for you.

To ensure you’re sending the right signal to crawlers, ensure you are setting the proper canonical metadata in the document <head>. Learn more about indexing here.

For showing domain specific content, look at the the platforms repo for how it uses dynamic routes (where you can then read the domain) and then uses that value in the function which talks to the database.

Hope this helps!

3 Likes

Thank you Lee you’re the best :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.