# How do I create a menu from my Shopify navigation links?

**URL:** <https://forum.builder.io/t/how-do-i-create-a-menu-from-my-shopify-navigation-links/405>\
**Category:** Technical Questions\
**Created:** [January 16, 2021, 1:14am UTC](https://forum.builder.io/t/how-do-i-create-a-menu-from-my-shopify-navigation-links/405 "2021-01-16T01:14:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![korey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/korey/32/12_2.png) [@korey](https://forum.builder.io/u/korey)\
**Post date:** [January 16, 2021, 1:14am UTC](https://forum.builder.io/t/how-do-i-create-a-menu-from-my-shopify-navigation-links/405/1 "2021-01-16T01:14:45Z")

</div>

It is essential to have a navigation menu on your site, and people usually place them at the top of the page, or on the side of the page for /collection pages. Most themes have nice menus built in, but in the case that you would like to build one out in Builder, it is entirely possible. The first step is to get the menu item data. To do this, drag a `custom code` block into the content where you want the menu to display. Within that code component, paste in the following code, replacing `impulse-main-menu` with the name of the menu [you built in shopify](https://help.shopify.com/en/manual/online-store/os/menus-and-links/editing-menus) and would like to use for your navigation:

```
<script>
  try {
    window.BuilderLeftMenuList = [
      {% for link in linklists.impulse-main-menu.links %}
        {
          active: {{link.active}},
          open: {{link.active}} || {{link.child_active}},
          childActive: {{link.child_active}},
          title: "{{link.title}}",
          url: "{{link.url}}",
          links: [
            {% for child_link in link.links %}
              {
                active: {{child_link.active}},
                open: {{child_link.active}} || {{child_link.child_active}} || {{link.active}} || {{link.child_active}},
                childActive: {{child_link.child_active}},
                title: "{{child_link.title}}",
                url: "{{child_link.url}}",
                links: [
                  {% for grandchild_link in child_link.links %}
                    {
                      active: {{grandchild_link.active}},
                      open: {{grandchild_link.active}} || {{grandchild_link.child_active}} || {{child_link.active}} || {{child_link.child_active}},
                      childActive: {{grandchild_link.child_active}},
                      title: "{{grandchild_link.title}}",
                      url: "{{grandchild_link.url}}",
                    },
                  {% endfor %}
                ]
              },
            {% endfor %}
          ]
        },
      {% endfor %}
    ];
  } catch (e) {
    console.log('error creating linklist data')
  }
</script>

```

What this custom script does is make the link data available to Builder when the page loads. The next step is to build out the navigation menu in Builder. Have a look at the following Builder fiddle to see how to do it, or just feel free to [download the json from the fiddle and upload it](https://forum.builder.io/t/download-uploading-content/280) into your content.

> **[Builder: Drag and drop page building for any site](https://builder.io/fiddle/8e734db76a8945daab77f4b33d9c1bce)**
>
> Builder is the first and only headless CMS with full visual drag and drop editing

The last step is to add the following custom code the content JS panel, which you can access by clicking the `Edit custom JS + CSS` on the Data tab within the editor:

```
if (Builder.isBrowser) {
  if (window.BuilderLeftMenuList) {
    state.leftNavigationLinks = window.BuilderLeftMenuList;
  }
}

```

This bit of code makes the data we printed to the `window` object available on the state object, so we can use it in our menu item.

This technique can be modified to suit whatever the shape of your navigation data is, you will just need to change the bindings in the navigation blocks.
