How to Handle Template File Save Location in Umbraco 13 (Multi-site Project with uSync)

Hi all,

I’m working on a multi-site setup in Umbraco 13, and I’m organizing my template files like this:

/Views
  /SiteA
    Home.cshtml
    About.cshtml
  /SiteB
    Home.cshtml
    Contact.cshtml

I’m using uSync to manage templates and document types across environments, and I’d like to keep each site’s Razor views in separate subfolders for clarity and maintainability.

:red_question_mark: My Questions:
Is there a way to customize where Umbraco saves .cshtml files when you create or edit templates in the Backoffice?

Can Umbraco be configured to recognize templates inside subfolders, like /Views/SiteA/Home.cshtml, instead of only /Views/Home.cshtml?

How do other teams usually handle Razor view organization for multi-site projects in Umbraco 13?

Right now, every time I save a template in the Backoffice, Umbraco writes to /Views/{alias}.cshtml, which:

Conflicts with my subfolder structure

Can cause confusion or even overwritten files if someone forgets to check the right path

I’m also concerned about syncing with uSync — the saved .cshtml files don’t always reflect the structure I’m trying to enforce.

:white_check_mark: What I’m looking for:
Best practices for working with template files in multi-site projects

Whether it’s possible to disable automatic view generation or override the path

Any experience from teams using uSync + multi-folder view organization

To be honest, I just always considered it a given that it has a fixed, flat file structure for templates. So we make sure that the naming of the templates reflects what it’s for. So in your example, I would have this list of views:

  • /Views/SiteAHome.cshtml
  • /Views/SiteAAbout.cshtml
  • /Views/SiteBHome.cshtml
  • /Views/SiteBAbout.cshtml

But depending om how much the sites differ from each other, you could also look into using the same templates for both sites and have the differences (for instances the css) be configurable via the backoffice.

1 Like

If you weren’t bothered about being able to view (in the backoffice), and with production mode enabled you can’t edit on your poduction environment so not a great loss..
There is perhaps the option to extend the Razor ViewLocations, so it can at least discover your folder of views when it doesn’t find them in the root of Views.

Looks like this could be a starting point?
Not possible to modify the options of the razor view engine · Issue #12157 · umbraco/Umbraco-CMS

1 Like

Another thought.. could you have you View/Template just be a wrapper to find the site in question.. and then render all the markup from partials(viewcomponents) from SITE folders in partials (partials/components) you have folder support there then.. though you loose all the niceties of template inheritance. :frowning:

1 Like