Plan your Template URLs
Plan your Template URLs before you create templates. When every address on your site fits one template, Studio picks it at once, and your live site shows the template you meant at every address.
The example on this page is the team blog: the Blog post template at /blog/{{entry.slug}}, News article at /news/{{entry.title}}, and the freeform About template at /about. Say your site also has a freeform Home template and a Landing page content type for marketing pages such as /pricing.
A site map where each address fits one template
Your marketing team makes pages such as /pricing as Landing page entries. Editors write posts under /blog and news under /news. Here is a set of Template URLs where no two templates compete for an address.
| Address | Template | Template URL | Why it's set this way |
|---|---|---|---|
/ | Home, freeform | / | A variable can't match /, so the home page is fixed text. |
/about | About, freeform | /about | Fixed text. It wins over the top-level template below. |
/pricing | Landing page | /{{entry.url}} | The one template at the top level. |
/blog/ai-101 | Blog post | /blog/{{entry.slug}} | Nested under /blog, so it has a prefix. |
/news/how-ai-works | News article | /news/{{entry.title}} | Nested under /news, so it has a prefix. |

Two rules make this work: one template at the top level, and a prefix for everything nested.
Keep two templates off one URL
Most shared URLs are accidents. Each template looks right on its own, and the clash shows up only when two of them fit the same address. Five rules keep every address to one template:
- Give each fixed Template URL to one template. Two freeform templates at
/aboutboth fit it, and nothing stops you saving them. - Give only one template a top-level Template URL, such as Landing page's
/{{entry.url}}. See One template at the top level. - Put a fixed prefix in front of every other variable, such as
/products/{{entry.url}}. See A prefix for everything nested. - Keep one template per content type, unless you're redesigning one. See One template per content type.
- Write every address the same way. See Write every address the same way.
If two templates do end up at one URL, see what Studio, Deploy and your live site do in When two templates share a URL.
One template at the top level
A Template URL with nothing in front of {{entry.url}}, such as Landing page's /{{entry.url}}, serves top-level addresses like /pricing. {{entry.url}} matches the whole address, so this template fits every address on your site. See Why entry.url matches the whole address.
That's fine for one template. A template with more fixed text, such as Blog post's /blog/{{entry.slug}}, still wins its own addresses, because Studio picks the closest match first. Landing page gets only the addresses nothing else fits.

Give only one template a top-level Template URL. Say the product team also gives a Product content type /{{entry.url}}, and both teams publish an entry at /summer-sale:
- Both templates fit every address, so Studio has to check each one for an entry.
- The canvas shows the notice Multiple Templates Use This URL.
- Your live site serves whichever template was deployed most recently.
- Deploy doesn't stop it, because the two templates are on different content types.
See When two templates share a URL.
The home page can't use {{entry.url}}, because a variable needs at least one character and / has none. Give the home page the Template URL /. A freeform page such as About at /about is fixed text, so it wins over /{{entry.url}} at its address.
A prefix for everything nested
Every address below the top level gets a fixed prefix in its Template URL, such as /blog/ and /news/. The prefix tells the templates apart. With /blog/{{entry.url}}, Studio still looks up the whole address in the URL field, but only Blog post fits addresses that start with /blog/. Studio settles the template at the first step and skips the entry check. See Which template wins when several match.
Set the prefix where the URL comes from
Set the prefix in Contentstack, on the content type, not in Studio. Studio takes a template's URL from the content type's Custom Preview URL row, or else its URL pattern. Put the prefix there, and Studio picks it up on its own:
- Every template on the content type gets it, including ones you create later. You don't edit any URL in Studio.
- Visual Editor and Live Preview open the same address, because they read the same source.
- When you change the prefix later, every template follows the next time you open it.

Set it in whichever source your content type uses. The Custom Preview URL wins when it has a row for the content type.
| Your content type's URL comes from | Set the prefix here |
|---|---|
| The Custom Preview URL | In Settings, then Visual Experience, then Preview URL, give the content type its own row whose path starts with the prefix, such as /blog/{{entry.slug}}, not /{{entry.slug}}. See Use a Custom Preview URL with Studio. |
| The content type's URL pattern | In the URL field's URL Properties, set Prefix, such as /blog/. Studio builds /blog/{{entry.url}}. Contentstack also adds the prefix to every entry's URL field, so the two stay in step. |
To see which one a template uses, see Where the Template URL comes from.
Type a URL in Edit URL only for the one template that has to differ. A URL you type no longer follows its source: when you change the Custom Preview URL or the URL pattern, that template keeps what you typed, and the Custom Preview URL's transformation rules stop applying to it. To follow the source again, reset the URL. See Go back to the derived URL.
When the URL field holds a full address, the prefix has to be how that address starts. AI 101's URL field holds /blog/ai-101, so /blog/{{entry.url}} is right. With /topics/{{entry.url}}, the canvas opens /blog/ai-101 and ignores /topics. Setting Prefix on the URL field avoids this, because Contentstack writes the prefix into every URL it generates.
One template per content type
A content type usually needs one template. Its Template URL comes from the content type's Custom Preview URL row or its URL pattern, so a second template on the same content type gets the same Template URL. Studio doesn't warn you when you create it.
The exception is a redesign. Build the new layout as a second template at the same URL, and deploy it as a secondary template. Visitors keep seeing the primary template, and reviewers open the new one from its link on your live site. Until you deploy, each template shows on the canvas when you open it. For the steps, from the first deploy to the swap, see Review a redesign, step by step.
Write every address the same way
- Start every Template URL with
/, and give your home page/. The canvas adds the Template URL to the base URL exactly as written, so the/between them has to come from the Template URL.blog/{{entry.slug}}openshttp://localhost:3106blog/ai-101, and never matches the paths your route passes. Studio refuses an empty Template URL. See How the base URL and the Template URL join. - Write base URLs without a
/at the end. Studio takes one/off the end of the base URL anyway, sohttp://localhost:3106andhttp://localhost:3106/open the same address. See How the base URL and the Template URL join. - Pick one rule for the slash at the end, and keep it on every template and in your route.
/blog/ai-101/and/blog/ai-101are two addresses. See Studio matches the address exactly. - Use a field that holds the address-ready value, such as
slugholdingai-101. See How Studio fills the Template URL for each entry. - Don't use a slug made only of a number, such as
2024. Add a letter, such asreport-2024. See Studio matches the address exactly. - Don't tell two templates apart only by a query string. Studio ignores it. See Studio matches the address exactly.
- Put the language in the base URL or in the Template URL, not both. See Put the language in the address.
- Pass Studio only the part of the address the Template URL describes. Take off anything your base URL adds in front, such as a base path or a language, once, in your route. See Pass Studio only the path the Template URL describes.
Where to go next
- Create the template: Create a template.
- See what happens when two templates end up at one URL: When two templates share a URL.
- See how Studio picks a template for an address: How Studio matches an address to a template.
- Change a Template URL by hand: Edit or reset a Template URL.