Sidebars

Description

The PHOS Framework has a separate file broken out for handling sidebars. Use sidebar.jade to edit the sidebar. There are several ways to manage the sidebar content. A straightforward coding approach would work well for a sidebar that is consistent across all pages of the site. For a more conditional approach, use the markup example in the comments of sidebar.jade.

Conditional Method

To create a modular, “conditional” sidebar (where some sections show up on certain pages and are hidden on others), create a series of php functions with the code for each section (see example above). For example – let’s say the sidebar for all interior pages has a block with the most recent blog post, but that block should NOT be displayed if on a blog page. The sidebar could be written as follows:

-function sidebar_example(){
    div(class="sidebar sample")
        p Hello, world!
- }

div(id="sidebar")
    - if(!is_single()):
        - sidebar_example()
    - endif

This is a cleaner way of writing conditionals and makes the code much more readable.

MENU