Copied to clipboard

Flag this post as spam?

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


  • Søren Kottal 712 posts 4570 karma points MVP 6x c-trib
    Jan 20, 2018 @ 20:36
    Søren Kottal
    0

    Change the default template generated when creating a new template

    Out of the box, when you create a template you get this markup:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.MyDocType>
    @using ContentModels = Umbraco.Web.PublishedContentModels;
    @{
      Layout = null;
    }
    

    I would like to enforce the use of UmbracoViewPage, and remove the unnecessary using statement (I already have Umbraco.Web.PublishedContentModels in Views/Web.config), so the fact that Umbraco creates this default bootstrap is just annoying and adding (though only a tiny bit) to the workload.

    Is it possible in any way to control the template boilerplate?

    What I would like, was to have a template like

    @inherits UmbracoViewPage<MyDocType>
    @{
      Layout = "Master.cshtml";
    }
    

    I've been surfing the source code, and tried a little myself. But it seems like I can't override the methods generating the template.

  • Mark 122 posts 255 karma points
    Jul 09, 2019 @ 09:39
    Mark
    0

    Hi Søren,

    I know this was asked a long time ago, but did you ever find a solution for this? I have the exact same requirement..

    It's just a little frustrating to edit each new template the same way every time, so not a killer if this isn't possible.

    Cheers :-)

    Mark

  • Søren Kottal 712 posts 4570 karma points MVP 6x c-trib
    Jul 16, 2019 @ 12:48
    Søren Kottal
    100

    Unfortunately not, it seems hardcoded.

Please Sign in or register to post replies

Write your reply to:

Draft