Developer forum

Forum » Swift » Custom Swift templates in Files/Templates/Designs/Swift_custom

Custom Swift templates in Files/Templates/Designs/Swift_custom

Roald Haahr
Reply

Hi,

In my notes from the Swift ERFA meeting, I have scribbled down that I should be able to overwrite Swift templates by adding a Swift_custom design folder. I have just tested this on a DW 9.15.7, and I am not seeing my changes from the templates in the Swift_custom folder. Have I misunderstood something and/or am I doing something wrong?

My folder structure

Files
   Templates
      Designs
         Swift
            * (All standard Swift templates)
         Swift_custom
            Swift_Master.cshtml
            Swift_Page.cshtml

Kind regards
Roald


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Roald

Technically Swift_page.cshtml is parsed into /Designs/Swift/_parsed/Swift_Page.parsed.cshtml where the master and the layout has been combined - and it is the .parsed template that is loaded.

So if you place a parsed template in /Designs/Swift_custom/_parsed/Swift_Page.parsed.cshtml that will be loaded.

This _Custom concept has not taken that into consideration.

May I ask why that would even be needed?

 
Roald Haahr
Reply

Hi Nicolai,

I don't know if we will have to overwrite the page and master templates. Right now I am just testing possibilities with the Swift_custom folder.

I did some more testing and I found that templates put in Swift_custom/Paragraph will in fact be used instead of the matching templates in Swift/Paragraph. So my folder structure is now.

Files
   Templates
      Designs
         Swift
            * (All standard Swift templates)
         Swift_custom
            Paragraph

               Swift_Poster.cshtml (Is used instead of the standard template)

            Swift_Master.cshtml (Not used)
            Swift_Page.cshtml (Not used)

With this in mind, I am now wondering if I can do the same for templates in the other design subfolders such as e.g. eCom, or is this feature limited to the Paragraph?

Kind regards
Roald

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

It will work for all other templates than Layouts (Designs/Swift/{layoutFile}.cshtml}

So it will also work for navigation, grid, ecom etc.

The templates that has includes will also need a copy of the include - and vice versa - includes in swift_custom will not be loaded from templates in Swift folder.

BR Nicolai

 
Roald Haahr
Reply

Alright, thanks :) We will try it out.

 
Roald Haahr
Reply

Hi Nicolai,

I tested this functionality on a Swift v1.19.0 / DW v9.15.7 trying to overwrite a checkout step template and a form template, but they are not overwriting the equivalent templates in the Swift folder when rendering the content. Templates placed in the Paragraph folder works. Please review my test setup below. I created more or less empty templates to get around the work of also copying a bunch of Helper templates.

Am I missing something?

Kind regards,
Roald

 

InformationAnonymous_v2.cshtml
Default.cshtml

 
Roald Haahr
Reply

Bump :)

 
Mads Poulsen
Mads Poulsen
Reply

Dear Nicolai,

– I've just been testing the same 'Swift_custom' functionality. I like the idea.
I have the .parsed file working – but the Swift_custom/file.cshtml isn't generating a parsed file.

– So, the structure that i want to rebuild within the 'Swift_custom' folder, isn't overriding and therefor not working.

Example:
- We want to make an adjustment within 'OrderSummary.cshtml'. It is included within various other templates, therefor making a lot of _Custom templates within the Swift designfolder. Trying to avoid that, we wanted to test this setup.

– Are we doing something wrong, or is this setup not final yet? If so, do you know if it will be an option in the near future?

 

You must be logged in to post in the forum