Previewing content
Answered
Sun bear posted this in #help-forum
Sun bearOP
Hello, i want to create a sub-domain which is something like
development.domain.com. On that domain i want to preview the page with content from a headless CMS with different dataset and different .env variables. How would i setup this? Do i mark the .env variables as "preview" or "development". Help is much appriciated!Answered by Clown
For preview builds you can set the environment variables differently in the settings.
Since this a different project, i would recommend pulling up another project on vercel and setting the subdomain to it. Then you can just set the environment variables while being in production
Since this a different project, i would recommend pulling up another project on vercel and setting the subdomain to it. Then you can just set the environment variables while being in production
11 Replies
Are you self hosting or using vercel etc
@Clown Are you self hosting or using vercel etc
Sun bearOP
Project is up and running on vercel but currently only on "production" dataset from headless cms
I have two datasets from headless cms(sanity), production and development and i'm wondering if they could be toggled via .env variables on two different branches/domains?
For preview builds you can set the environment variables differently in the settings.
Since this a different project, i would recommend pulling up another project on vercel and setting the subdomain to it. Then you can just set the environment variables while being in production
Since this a different project, i would recommend pulling up another project on vercel and setting the subdomain to it. Then you can just set the environment variables while being in production
Answer
Preview builds are any builds other than the main branch. Just push to another branch and its going to pop up as a preview
Sun bearOP
Ah okay, so optimal setup would be two projects with the same repo, but different "main" branch and .env variables?
And also different domains?
Personally yeah. You can just change the "main" branch in the settings. By default its the master or main branch
Sun bearOP
Okay 👠Do you know if it's possible to have two projects with same repo or do i need also a new repo?
@Sun bear Okay 👠Do you know if it's possible to have two projects with same repo or do i need also a new repo?
You can have two projects with the same repo
@Clown You can have two projects with the same repo
Sun bearOP
Alright thanks! ðŸ‘