sapwood

Menus

v1.4 introduced the option for custom menus. Menus are built just like pages, as they are nested within each other. Adding and editing menu items is a bit time-consuming at the moment, but it at least gives you the option to create dynamic menus.

Building Menus

There are enhancements planned for menus, but for now, once you have working with pages figured out, building a menu will be super simple.

Linking to a Page

You can optionally link a menu item to an existing page in Sapwood. This, however, will overwrite any custom URL you've included when the menu item is saved.

Custom URLs

To include a custom URL as your menu item, you need to be sure you are not linked to a page, and then you'll be fine.

If you want to open up a new tab, it's up to you to alter the markup with javascript after the page has been rendered.

Rendering Menus

A menu has a slug or method_name, which is how you access the menu. To render a menu, all you have to do is find the slug for that menu and then call:

<%= viewer_menu(slug) %>

This wraps the entire menu in a nav tag, and then creates nested lists using the labels and URLs of the menu items. So, the tree structure might be something like this:

<nav>
  <ul>
    <li>
      <a></a>
      <ul>
        <li>
          <a></a>
          <ul>
            <li>
              <a></a>
            </li>
          </ul>
        </li>
      </ul>
    </li>
  </ul>
</nav>