How to display .master templates from the /masterpages directory in Umbraco 7
Today I successfully created a web form master page through Umbraco 7 and connected it to a content page.
Is there anyway to tell Umbraco to also look inside my /masterpages directory for .master template files, rather than just the /Views directory?
I set my defaultRenderingEngine to WebForms and recycled my app pool in IIS, but no matter what, whenever I create a template, Umbraco saves it in my /Views directory.
How can I have Umbraco save templates to /masterpages
Thanks Michael. That was a good read, and I know understand that there is a high level of complexity of changing the views location in Umbraco because its tightly integrated with the rest of the system.
With that said, is there anyway .master templates can be read from within the /views directory rather than being in the /masterpages location? My end goal is trying to get umbraco backoffice to allow us to view / modify / connect web form .master templates to content pages. Is this possible?
in your backoffice under settings you see the templates tree node.
There we always start by creating a Master template ( not linked to a document type ). You can do this by right clicking Templates and choose create.
Then you name it Master and click Save. So now you can edit the master page file directly from within the backoffice.
Then your other templates that will use the master page has to be linked to this master page. You can do this by going to the template properties and set the master template to Master.
Michael you are an asset for Umbraco and I thank you very much for educating me on this. If you don't mind helping me a little further...
I created a .master template just like you instructed. I applied the master page template logic you mentioned as well.
But when I create a new Umbraco content page, it does not show me options to connect that page to the template I just created. I had to create a document type without template, and attach my master template to it.
I was then able to create a new umbraco content page with this master template. But when I went to preview the page I got a server side error saying that there is no physical template associated.
To fix the error, I had to go into visual studio and copy my master template into the /masterpages directory.
This is the struggle I have. I would like to keep my master page in my /views directory. But Umbraco complains if it is not within the /masterpages directory.
For some reason it all makes sense now and I'm seeing it in action. When working with webforms, it does create my master template in my masterpages directory. I was then able to link a document type to the template, and finally associate a content page to the document type.
How to display .master templates from the /masterpages directory in Umbraco 7
Today I successfully created a web form master page through Umbraco 7 and connected it to a content page.
Is there anyway to tell Umbraco to also look inside my /masterpages directory for .master template files, rather than just the /Views directory?
I set my defaultRenderingEngine to WebForms and recycled my app pool in IIS, but no matter what, whenever I create a template, Umbraco saves it in my /Views directory.
How can I have Umbraco save templates to /masterpages
Thanks
Hi Kensley,
have a look at this thread here on the Community Forum where you can see the pitfalls and possibilities of doing this:
https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/70906-change-template-view-location
Have a nice day!
/Michaël
Thanks Michael. That was a good read, and I know understand that there is a high level of complexity of changing the views location in Umbraco because its tightly integrated with the rest of the system.
With that said, is there anyway .master templates can be read from within the /views directory rather than being in the /masterpages location? My end goal is trying to get umbraco backoffice to allow us to view / modify / connect web form .master templates to content pages. Is this possible?
Hi kensley,
in your backoffice under settings you see the templates tree node.
There we always start by creating a Master template ( not linked to a document type ). You can do this by right clicking Templates and choose create.
Then you name it Master and click Save. So now you can edit the master page file directly from within the backoffice.
Then your other templates that will use the master page has to be linked to this master page. You can do this by going to the template properties and set the master template to Master.
Hope this helps!
/Michaël
You can also find some more information about masterpages here:
https://our.umbraco.org/documentation/reference/templating/Masterpages/
/Michaël
Michael you are an asset for Umbraco and I thank you very much for educating me on this. If you don't mind helping me a little further...
I created a .master template just like you instructed. I applied the master page template logic you mentioned as well.
But when I create a new Umbraco content page, it does not show me options to connect that page to the template I just created. I had to create a document type without template, and attach my master template to it.
I was then able to create a new umbraco content page with this master template. But when I went to preview the page I got a server side error saying that there is no physical template associated.
To fix the error, I had to go into visual studio and copy my master template into the /masterpages directory.
This is the struggle I have. I would like to keep my master page in my /views directory. But Umbraco complains if it is not within the /masterpages directory.
Hi kensley,
viewing the docs Umbraco will always search for the views in the masterpages folder when working in webforms.
Is it a solution to start using MVC instead of webforms? Then your templates will be located in the views folder.
Have a nice day!
/Michaël
For some reason it all makes sense now and I'm seeing it in action. When working with webforms, it does create my master template in my masterpages directory. I was then able to link a document type to the template, and finally associate a content page to the document type.
Thanks for helping me think through this!
No problem kensley!
Have a nice day and enjoy working with Umbraco! If you have any further questions just ask it here at the communty!
We are here for you!
/Michaël
is working on a reply...