Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • blackhawk 313 posts 1368 karma points
    Mar 21, 2017 @ 13:55
    blackhawk
    0

    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

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Mar 22, 2017 @ 07:22
    Michaël Vanbrabandt
    1

    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

  • blackhawk 313 posts 1368 karma points
    Mar 22, 2017 @ 13:59
    blackhawk
    0

    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?

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Mar 22, 2017 @ 14:07
    Michaël Vanbrabandt
    1

    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.

    enter image description here

    Hope this helps!

    /Michaël

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Mar 22, 2017 @ 14:13
    Michaël Vanbrabandt
    1

    You can also find some more information about masterpages here:

    https://our.umbraco.org/documentation/reference/templating/Masterpages/

    /Michaël

  • blackhawk 313 posts 1368 karma points
    Mar 22, 2017 @ 17:19
    blackhawk
    0

    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.

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Mar 22, 2017 @ 19:28
    Michaël Vanbrabandt
    100

    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

  • blackhawk 313 posts 1368 karma points
    Mar 22, 2017 @ 22:12
    blackhawk
    1

    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!

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Mar 23, 2017 @ 07:17
    Michaël Vanbrabandt
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft