<p>Global is not really the best option for dynamic navigation, because by definition it is designed to contain just one of something — and while it supports multiple fields, it only supports one instance of each field. Technically you could use a field within the global that supports multiple items (i.e. <code>table</code> fieldtype or <code>matrix</code> fieldtype), but none of the fieldTypes support hierarchical structures natively, so I don't see the advantage. Or you could simply paste static HTML into a text field, but I wouldn't really classify that as dynamic. Overall, not a particularly good option.</p>

<p>You should probably be looking into using a 'structure' (or to a lesser extent 'categoryGroup'), where each entry would represent a page or nav item, organized hierarchically. In this way you can reuse the same field within each entry (i.e. 'title') and loop through the entries to dynamically generate the nav, with the added benefit of being able to reorganize the nav easily using drag-and-drop.</p>

<p>For more information, see:</p>

<ul>
<li>Documentation on using the <a href="http://buildwithcraft.com/docs/templating/nav" rel="nofollow noreferrer">nav</a> tag.</li>
<li>Documentation on <a href="http://buildwithcraft.com/help/entry-type-templates" rel="nofollow noreferrer">giving each Entry Type it's own template</a>.</li>
<li>Answers from previous questions, such as <a href="https://craftcms.stackexchange.com/a/6847/784">here</a> and <a href="https://craftcms.stackexchange.com/a/4772/784">here</a>.</li>
<li>Check out some of the dedicated nav building plugins, such as <a href="http://straightupcraft.com/craft-plugins/a-m-navigation" rel="nofollow noreferrer">a&amp;m navigation</a> or <a href="http://straightupcraft.com/craft-plugins/craftnav" rel="nofollow noreferrer">craft nav</a>.</li>
</ul>

CC BY-SA 3.0
2015-05-18T19:10:10.180Z
Thanks for the advice I'm new to craft, I am only looking for a simple nav with no drop downs and I have actually figured out a way of doing it by creating 6 fields, menuLink1, menuLink2 etc, that have a field type of entries and using {{ globalHandle.menuLink1.first().url }} it works fine. What are the disadvantages of this?
Steve
CC BY-SA 3.0
2015-05-18T19:28:39.453Z
The disadvantage is that you are creating fields to represent each page/url. What happens when you need 'menuLink7'? Or you decide to change the order? Or want to disable a section temporarily? There is also no way to loop through your nav items (without looping through the fieldLayout, etc.) What you are doing is essentially creating static nav, that just happens to be stored in a database — which is fine but not really taking advantages of the capabilities of craft.
Douglas McDonald
CC BY-SA 3.0
2015-05-18T18:36:40.537Z
2015-05-18T18:42:32.460Z
2017-04-13T12:50:59.930Z
Douglas McDonald
<p>Hi guys does anyone know how I might go about creating a dynamic navigation using a global with the navigation items as fields, is this even possible?</p>

<navigation>
Dynamic navigation using a global
# Dynamic navigation using a global

(Asked by: username_0 on 2015-05-18)

Hi guys does anyone know how I might go about creating a dynamic navigation using a global with the navigation items as fields, is this even possible?

**Tags:** navigation

---

## 1 answers

### Answer by username_1 on 2015-05-18. Score: 4 | Accepted answer

Global is not really the best option for dynamic navigation, because by definition it is designed to contain just one of something — and while it supports multiple fields, it only supports one instance of each field. Technically you could use a field within the global that supports multiple items (i.e. `table` fieldtype or `matrix` fieldtype), but none of the fieldTypes support hierarchical structures natively, so I don't see the advantage. Or you could simply paste static HTML into a text field, but I wouldn't really classify that as dynamic. Overall, not a particularly good option.

You should probably be looking into using a 'structure' (or to a lesser extent 'categoryGroup'), where each entry would represent a page or nav item, organized hierarchically. In this way you can reuse the same field within each entry (i.e. 'title') and loop through the entries to dynamically generate the nav, with the added benefit of being able to reorganize the nav easily using drag-and-drop.

For more information, see:

* Documentation on using the [nav](http://buildwithcraft.com/docs/templating/nav) tag.
* Documentation on [giving each Entry Type it's own template](http://buildwithcraft.com/help/entry-type-templates).
* Answers from previous questions, such as [here](https://craftcms.stackexchange.com/a/6847/784) and [here](https://craftcms.stackexchange.com/a/4772/784).
* Check out some of the dedicated nav building plugins, such as [a&m navigation](http://straightupcraft.com/craft-plugins/a-m-navigation) or [craft nav](http://straightupcraft.com/craft-plugins/craftnav).

> **Comments:**
> **username_0**: Thanks for the advice I'm new to craft, I am only looking for a simple nav with no drop downs and I have actually figured out a way of doing it by creating 6 fields, menuLink1, menuLink2 etc, that have a field type of entries and using {{ globalHandle.menuLink1.first().url }} it works fine. What are the disadvantages of this?  
> **username_1**: The disadvantage is that you are creating fields to represent each page/url. What happens when you need 'menuLink7'? Or you decide to change the order? Or want to disable a section temporarily? There is also no way to loop through your nav items (without looping through the fieldLayout, etc.) What you are doing is essentially creating static nav, that just happens to be stored in a database — which is fine but not really taking advantages of the capabilities of craft.  

---

