Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.
Tyler Barnes edited this page Jan 5, 2019 · 1 revision

Menu data lives at /wordsby/data/menus.json in your gatsby site. This file is updated via github or gitlab api every time you save a menu. You can call menus by their slug using the Wordsby component <MenuItems />

import MenuItems from "../wordsby/MenuItems"; // this file is in wordsby-starter

For simplicity you can use <MenuItems slug="slug-name" /> to return a group of gatsby links.

For more control use children as a function to get the menu items:

<MenuItems slug="main-menu">
  {items => {
    return items.map(({ url, active, activeParent, title }) => (
      <Link
        key={url}
        to={url}
        className={active || activeParent ? "active" : ""}
      >
        {title}
      </Link>
    ));
  }}
</MenuItems>