Rocket
On this page

Menus#

Rocket builds a pageTree from discovered Pages. Layouts and menu components use that tree for site navigation, table-of-contents links, and previous/next links.

Use config.menu in the Page config to control how that Page participates in navigation:

export const config = {
  path: '/components/button',
  metadata: { title: 'Button' },
  menu: {
    parent: '/components',
    order: 20,
    linkText: 'Button',
    iconName: 'box',
  },
};

Options:

For predictable ordering, set menu.order on all sibling Pages whose order matters. Otherwise, siblings sort by link text or path-derived name.

Parent groups#

menu.parent changes only the menu location. The Page still renders at its own config.path:

export const config = {
  path: '/component-loading',
  metadata: { title: 'Component Loading Strategies' },
  menu: {
    parent: '/guides',
    order: 10,
  },
};

This Page appears below the /guides menu group.

If no concrete Page exists at an intermediate menu path, Rocket creates a non-clickable placeholder group from the path segment.

For Markdown Pages:

ValueResolution order
Link textconfig.menu.linkText, then the link-text attribute on the first h1
Titleconfig.metadata.title, then first h1 text, then link text, then fallback from config.path

For JavaScript Pages:

ValueResolution order
Link textconfig.menu.linkText
Titleconfig.metadata.title, then link text, then fallback from config.path

The title is used for the document title. The link text is used for menus. If no link text exists, menu components use the resolved title.

Markdown headings receive fragment ids and permalink anchors in the rendered HTML. They are also collected into pageData.toc. Layouts can render that with <rocket-toc>.

Use link-text to change a heading's table-of-contents label:

<h2 link-text="API">Application Programming Interface</h2>

Use menu-exclude to omit a heading from the table of contents:

<h2 menu-exclude>Generated output details</h2>

Markdown Pages may have only one h1, and heading levels should not skip levels.

The atlas docs layout registers these menu components:

The lower-level <main-menu> component is exported from @rocket/js/menus.js for custom layouts.

For the pageData.pageTree and pageData.toc shapes these components consume, see PageData.