Skip to main contentUpcoming webinar: Make Validation a Practice, Not a Phase. Save your seat.
CONTACT SALESSTART BUILDING
Landing pages
Blog Article
Hero Section
Navigation Links
Announcement Bar
Product Details
Product Editorial
Homepage
Request a blueprintGo to developer docs

Integrate Navigation Links

Navigation links are often best as minimal, structured data that your team mates can edit with a form interface.

Model definition

A structured data model named navigation-links is all you need, with a couple fields:

nametypenotes

links

list

with sub fields:

nametype

url

url

text

text

Example Code

// pages/your-page.jsx

import { builder } from '@builder.io/react';

// Replace with your Public API Key.
builder.init(YOUR_API_KEY);

export async function getStaticProps() {
  const links = await builder.get('navigation-links', {
    // You can use options for queries, sorting, and targeting here
    // https://github.com/BuilderIO/builder/blob/main/packages/core/docs/interfaces/GetContentOptions.md
  }).promise();

  return {
    props: {
      links: links || null,
    },
    revalidate: 5,
  };
}

export default function Home({ links }) {
  return (
    <>
      <header>
        <nav>
          {links.data.links.map((link, index) => (
            <a key={index} href={link.data.url}>
              {link.data.label}
            </a>
          ))}
        </nav>
      </header>
      {/* Put the rest of your page here. */}
      <RestOfYourPage />
    </>
  );
}