Include dynamic name template in layout


#1

I have this basic layout. I want to include a dynamic header to be included in the template. +header should be like this +{{get_header_name}}. get_header_name is a helper function. I tried this idea but jade will throw an error. Any ideas how to make it dynamic?

basic.jade

template(name="basicLayout")
    #main
        header
            +header // <--- make this a dynamic using helper (get_header_name)
            +search
        else
            +yield
        footer
            +footer

#2

You have to use Template.dynamic:

template(name="basicLayout")
    #main
        header
            +Template.dynamic(template=header)
            +search
        else
            +yield
        footer
            +footer