Navigation

Take a tour!

Navigation

Creating navigation elements that are able to grow and adapt over time is easy with aPeel.  In the navigation area of the admin you can create as many different menus as you need.  A menu is simply a list of links.  Each link has a destination URL and a title to describe the link.  Each menu can be rearranged and expanded as needed from within the admin.  You can then pull these menus into your layout. 

The Easy Way

It's easy to add a pre-formatted menu to any layout, template or page.

{{ 'Top Menu' | menu_list }}

The Hard/Customizable Way

If you need to customize the way your menu is rendered you can use the following steps.

Step 1: Get a hold of a menu

The first step to using a menu within your layout is assigning the menu to a variable so that you can work with it.

{{ 'Top Menu' | menu | assign_to: 'menu' }}

That code will grab a menu with the title of "Top Menu", and assign it to a variable called "menu".  That will allow you to do something like "menu.links", as we will see next.

Step 2:  Use the menu

<ul class="menu">
{% for link in menu.links %}
<li> <a href="{{link.url}}">{{link.title}}</a> </li>
{%endfor%}
</ul>

Using these simple tools you can create navigational elements within your layout that can be easily updated through the admin interface.