Skip to content

Optional side nav #68

@mrchief

Description

@mrchief

Some of my pages have a side nav (not all, just a few). I'm using bootstrap and I was wondering how I could add proper classes when the sidenav file is present.

So when sidenav is present:

---col-3--- | ---col-9---
sideNav     | page content

when not:

---col-12---
page content

My first shot was to do something in layout.jade but I cannot figure out how to check if the sideNav file is present or not in a simple way.

Here's roughly what I'd like to do in _layout.jade:

div.content-wrapper
    if(current folder has a _sideNav.jade)
        .sidebar-wrapper
            != partial(current.path.join('/') + '/_sideNav')

        article.main-container
            != yield
    else
        article.main-container
            != yield

Is this doable? Or is there a better way to handle this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions