When two templates share a URL
Your live site serves one template at an address. Read this page when two templates end up with the same Template URL, so you know what each tool shows and what Deploy does.
Most of this page is about two templates on the same content type. That's the case Studio handles for you. One of them is the primary template that visitors see, and the others can stay published as secondary templates that open only from a link. See Primary and secondary templates. Two templates on different content types, or freeform templates, behave differently, and you fix those by giving each its own URL.
The example on this page is the Blog post template at /blog/{{entry.slug}}, previewing AI 101 at /blog/ai-101. Say you're redesigning it as a second template, Blog post v2, on the same Blog post content type. The names come from the team blog.
Which shared URLs Studio settles for you
It depends on whether the two templates are connected templates on the same content type.
- Connected templates on the same content type: Studio keeps one primary template at the URL. Visitors see the primary template. Any other template can stay published as a secondary template, which opens only from its
cs-templatelink. When you deploy one where the other is primary, Studio asks which should be primary. See What Deploy asks when another template is primary at the URL. - While you work, nothing clashes. The canvas shows the template you opened. Visual Editor and Live Preview ask which template to open, with Select Page. See What the canvas and Visual Editor show for a shared URL.
- Different content types, or a freeform template: Studio doesn't settle it. The canvas shows the one updated most recently, with the notice Multiple Templates Use This URL. Deploy doesn't check, and visitors get the one deployed most recently. Give each template its own URL. See Fix a shared URL between different content types or freeform templates.
With @contentstack/studio-react 2.0.1 or older, the notice also shows on the same content type, when the template you opened is the one your live site serves. See If it doesn't work.
Three ways two templates end up with one URL
Two templates can fit one address in three ways. Which way it happened decides whether Studio settles it for you.
1. Two templates on the same content type get the same Template URL. This is the case Studio handles.
- You create a second template on the content type. A connected template's URL comes from the content type's Custom Preview URL row, then its URL pattern, then a default. The first two belong to the content type, so the new template gets the same Template URL. Only the default URL is unique. The create dialog doesn't check URLs, so nothing tells you. See Where the Template URL comes from.
- You type a URL another template is live at. Edit URL says "Blog post is already live at this URL on production." You can still save. The note names primary templates only, not secondary ones. See Edit or reset a Template URL.
Your live site still never gets two templates at the URL this way. When you deploy one of them, Studio makes one of them primary. See What Deploy asks when another template is primary at the URL.
2. Two templates have the same fixed Template URL. Two freeform templates at /about, such as About and an About page someone made to try a new layout, both fit /about. So does a connected template whose Template URL is the fixed text /about. Nothing stops you giving two templates the same fixed Template URL.
3. Templates on different content types have Template URLs that fit the same address. This happens most often with no fixed prefix. Say Landing page and Product both use /{{entry.url}}, and both teams publish an entry at /summer-sale. Each Template URL looks right on its own, so nothing warns you when you set it. Both templates fit /summer-sale equally. It also happens with the same pattern on two content types, such as Blog post and Topic page both at /blog/{{entry.slug}}, with an entry called ai-101 on each.
In cases 2 and 3, you find out in Studio. When you open either template at that address, the canvas shows the notice Multiple Templates Use This URL. To keep any of the three from happening by accident, plan your Template URLs first. See Keep two templates off one URL. See Fix a shared URL between different content types or freeform templates.
What the canvas and Visual Editor show for a shared URL
What you see while you edit depends on whether the two templates are on the same content type.
On the same content type, nothing clashes. Studio knows which template you're working on.
- The canvas shows the template you opened, with no Multiple Templates Use This URL notice.
- Visual Editor and Live Preview work per content type. Whenever two templates use it, they open Select Page and ask which one to open for the entry. Secondary templates are in the list too. Visual Editor opened from Studio opens the template you were editing. See When two templates use the content type.
- Your code can't choose between them when it fetches by content type. See Ways to fetch a template.
- Your live site keeps serving the primary template.
- Open in new tab opens the template you're editing on your site. When another template is primary at its URL, Studio adds
cs-templatewith this template's composition UID. The tab shows what's deployed, so until you deploy this template, it shows a 404. See Share the link to a secondary template.
On different content types, or with a freeform template, the canvas can show the other template. Studio can't tell which one you mean.
- The canvas shows the template updated most recently, which may not be the one you opened. The notice Multiple Templates Use This URL names the template it shows. Edit URL opens the dialog, and Open opens the other template. See Multiple Templates Use This URL.
- Visual Editor and Live Preview open each content type's own template. A freeform template has no entries, so they don't open it.
- Your live site serves the one deployed most recently.
To make the canvas show the template you're editing, give each template its own URL. See Fix a shared URL between different content types or freeform templates.
What Deploy asks when another template is primary at the URL
This applies to connected templates on the same content type, at the same Template URL. When you deploy Blog post v2 to production while Blog post is primary there, Studio opens Another template is primary at this URL. It asks whether to deploy Blog post v2 as secondary, swap the two, or unpublish Blog post.
Each environment and language gets its own result, and only deployed templates at that URL count. Where none is primary, the template becomes primary. A publish from outside Studio, such as from Contentstack or a Release, skips the dialog.
For each choice and screen, see When another template is primary at the URL. For the model and each case, see Primary and secondary templates. The Studio API runs the same check and answers with url_collision. See When another Template is primary at the URL.
Redesign a template
Say you want a new layout for every blog post, and visitors should keep the old one until the new one is ready. You can do it three ways.
Change the template you have. Edit Blog post itself. Your changes stay in its draft, and visitors keep seeing the deployed version until you deploy again. Nothing shares a URL, so there's nothing to settle. This is the simplest way, and the one to pick unless people need to see the new layout on your site first.
Build the redesign as a second template, and try it on the live address. Create Blog post v2 and connect it to the Blog post content type. It gets the same Template URL as Blog post, /blog/{{entry.slug}}. Deploy it as a secondary template, share its link for review, then swap it in. See Primary and secondary templates. Use this when reviewers need to see the new layout on your real site, or when you still fix things in Blog post meanwhile.
Check it on a staging site first. Deploy the template to staging and review it there before you deploy to production. See Promote across environments.
For the second way, step by step, see Review a redesign, step by step.
Fix a shared URL between different content types or freeform templates
Cases 2 and 3 in Three ways two templates end up with one URL are templates on different content types, or freeform templates. Deploy checks only connected templates on the same content type, and only those can be secondary templates. Studio can't settle anything else for you, so give these templates their own URLs.
A freeform template wins its address over a Template URL with less fixed text, such as /{{entry.url}}. At the same fixed Template URL as a connected template, it's a tie. See A freeform template and a connected template at one address.
In each case:
-
The canvas shows the template updated most recently, with the notice Multiple Templates Use This URL. It names the template the canvas shows.

-
Deploy doesn't stop either one going live.
-
Your live site serves the one deployed most recently.
Give each template its own URL. Put a fixed prefix in front of a variable, such as /products/{{entry.url}} for Product or /topics/{{entry.slug}} for Topic page. For the rules, see Keep two templates off one URL.
If it doesn't work
- The notice shows for two templates on the same content type. Your app's Studio SDK is 2.0.1 or older. Upgrade
@contentstack/studio-react, and the notice no longer shows for them. - A secondary template's link doesn't work. See If it doesn't work on Primary and secondary templates.
- Visual Editor asks Select Page for every Blog post entry. Two templates use the content type, secondary ones included. Once you've retired Blog post, delete it.
- Deploy didn't ask, and your live site shows the other template. The two templates are on different content types, one is freeform, or their URLs are written differently, such as
/blog/{{entry.slug}}and/blog/{{entry.title}}. Give each its own URL.
Where to go next
- Keep both templates published, one primary and one secondary: Primary and secondary templates.
- See each screen of the deploy dialog: When another template is primary at the URL.
- Plan URLs so each address fits one template: Plan your Template URLs.
- See how Studio picks a template for an address: How Studio matches an address to a template.