New file based templates?

Posted by Community Admin on 05-Aug-2018 14:13

New file based templates?

All Replies

Posted by Community Admin on 06-Aug-2015 00:00

Hi guys,

We're just building out our site and are using a ResourcePackage folder (copied from the default Bootstrap one) as the basis. We're trying to figure out how we can create multiple templates that are inherited from other templates using the file system but this doesn't seem possible.

For example when you first activate Feather you get a set of default templates for Bootstrap, Foundation, etc. These are the the "1 Column, Header, Footer", "Left Sidebar, Header, Footer", etc. ones.

With the file system we have a file called default.cshtml in the MVC/Views/Layouts folder which shows up under our custom group but the only way to get new templates that are file based is to copy that file to another name (say default2.cshtml) and it'll show up.

What we want to do is something like create the default.cshtml file as our master page, then copy that file to say blog.cshtml and add 1 or 2 elements, then use blog.cshtml as the starting page and create 3 more templates from it, finally use those templates as the basis for our content pages.

We can do this with creating templates in the backend by selecting the previous one as a starting point, rather than creating one from scratch but I can't seem to find any way to do this in the file system. The problem with doing it via the GUI is that we have the problem of moving that to another environment. With the file system we can simply rebuild the site and copy it up from DEV -> TEST -> PROD. Don't know how to do this promotion using content in the database (I assume it might involve the sync feature, but not even sure how that works when trying to separate templates vs. content)

Pouring through the Feather code I found the LayoutFileManager.cs that seems to be creating these templates (CreateDefaultBootstrapTemplates(), CreateDefaultFoundationTemplates(), etc.) so is this the only way to do it? Seems like a breakdown in being able to use the files in the ResourcePackage folder(s) and having to build a module to kick it off. Also I'm not sure how this will survive say adding a new template, how does this approach not blow away the old templates (and how is it even triggered).

Hopefully someone can answer this or drive us to the right way to do master pages with multiple inherited children pages without having to redeploy the entire site each time. It just seems that the whole file based layouts depending on code to work seems to be awkward at best.

Thanks

Posted by Community Admin on 06-Aug-2015 00:00

I'm looking to do the exact same thing. Additionally, is it possible to add the user-friendly names to the template rather than just based on the file name?

This thread is closed