2 Columns

Description

2 Columns layout is the most common and popular layout, it has a navigation with content section. This layout use the common navbar and footer sections, however you can add customized header or footer on page level.

CSS Classes

This table contains all classes related to the 2 columns layout. This is a custom layout classes for 2 columns layout page requirements.

All these options can be set via following classes:

Classes Description
.2-columns You can create 2 columns layout by adding .2-columns class in <body> tag.

HTML Markup

This section contains HTML Markup to create 2 columns layout. You need to add the .2-columns class in the <body> tag as show in below markup on line no 4. This layout has a navigation and content sections with common header & footer.

Stack has a ready to use starter kit, you can use this layout directly by using the starter kit pages from the stack-admin/starter-kit folder.

        
            <!DOCTYPE html>
              <html lang="en">
                <head></head>
                <body data-menu="vertical-menu" class="vertical-layout vertical-menu 2-columns menu-expanded">
                  
                  <!-- fixed-top-->
                  <nav role="navigation" class="header-navbar navbar-expand-sm navbar navbar-with-menu fixed-top navbar-dark navbar-shadow navbar-border">
                  </nav>
                  
                  <!-- BEGIN Navigation-->
                  <div class="main-menu menu-dark menu-fixed menu-shadow">
                  </div>
                  <!-- END Navigation-->
                  <!-- BEGIN Content-->
                  <div class="content app-content">
                  </div>
                  <!-- END Content-->
                  <!-- START FOOTER DARK-->
                  <footer class="footer footer-dark">
                  </footer>
                  <!-- START FOOTER DARK-->
                </body>
              </html>
        
        

JADE Configuration

Stack Admin use JADE as template engine to generate pages and whole template quickly using node js, for getting start with JADE usage & template generating process please refer template documentation.

JADE Variables

This table contains required JADE variables to generate 2 columns layout.

Block Variable Datatype Value Description
pageConfig contentLayout string '2-columns' pageConfig block has a page configuration variables, for 2 columns layout you need to define variable - var contentLayout = '2-columns'
JADE Code

To generate 2 columns layout page or template, you need to use following JADE code.

Line no 19-20: Default value of contentLayout variable is '2-columns'. Its is optional to set contentLayout variable value as '2-columns' in pageConfig block.

If you want to use this layout on page level you need to define it on page it self. This template has one example jade file for 2 columns layout-2-columns.jade, however you can use it on template level but it will generate whole template as a 2 columns.

              
                block pageVars
                        - var pageTitle    = "2 Columns"
                        - var pageSubTitle = "2 columns layout with navigation"
                        - var description  = "The full width 2 columns layout with content & navigation section."
                        - var activeMenu   = "layout-2-columns"
                
                extends template
                
                append pageConfig
                    - var contentLayout = '2-columns'
                
                append breadcrumbs
                        +breadcrumbs([{url:"index.html",name:"Home"},{url:"#",name:"Page Layouts"}, {name:"2 Columns"}])
                
                //- Include page content in page block
                append content
                        include ../contents/layout-2-columns.html
                
                //- Vendor CSS
                //------------------------------
                //- Add Vendor specific CSS
                append vendorcss
                
                //- Page CSS
                //------------------------------
                
                //- Add custom page specific CSS
                append pagecss
                
                //- Vendor JS
                //------------------------------
                //- Add vendor specific JS
                append vendorjs
                
                //- Page JS
                //------------------------------
                //- Add custom page specific JS
                append pagejs