TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/shuding/nextra/llms.txt
Use this file to discover all available pages before exploring further.
_meta.js file is one of the most important conventions in a Nextra project. By placing a _meta.js file inside any content directory, you control the order pages appear in the sidebar, assign human-readable titles, add external links, define section separators, and create dropdown menus — all without touching individual page files.
How It Works
Nextra collects_meta.js files from two locations:
app/directory — alongsidepage.mdandpage.mdxfilescontent/directory — alongside.mdand.mdxfiles
_meta.js file is merged into a site-wide pageMap that your Nextra theme uses to render the sidebar and navbar.
If a route is not listed in
_meta.js, Nextra still includes it in the sidebar, appended at the end in alphabetical order (with index always first if unlisted).Basic Usage
A_meta.js file exports a default object. The keys are page slugs (matching file names without extensions); the values are either a string title or a configuration object:
_meta.js
MetaRecord type for full type safety:
_meta.ts
Title Types
Titles can be a plain string or a JSX element, allowing you to embed icons or styled text directly in the sidebar:_meta.jsx
Page Item Options
When a value is an object (rather than a plain string), the following fields are available:type: 'page' — Promote to Navbar
By setting type: 'page', a top-level entry is displayed in the navigation bar instead of the sidebar. This enables “sub-docs” — multiple distinct documentation sections that each appear as a top-level nav item:
_meta.js
display: 'hidden' — Hide from Sidebar
The page remains accessible via its URL but is not shown in the sidebar:
_meta.js
display: 'children' — Show Children, Hide Folder
When applied to a folder, display: 'children' hides the folder itself from the sidebar while still rendering all its child pages. This is useful for grouping content logically without creating a visible parent node:
_meta.js
theme — Per-Page Theme Overrides
The theme option lets you toggle individual UI components on or off for a specific page (or an entire folder):
_meta.js
theme fields:
| Field | Type | Default | Description |
|---|---|---|---|
breadcrumb | boolean | true | Show/hide breadcrumb navigation |
collapsed | boolean | false | Collapse the sidebar item by default |
copyPage | boolean | true | Show/hide the “Copy page” button |
footer | boolean | true | Show/hide the page footer |
layout | 'default' | 'full' | 'default' | Page layout style ('full' uses the full container width) |
navbar | boolean | true | Show/hide the top navigation bar |
pagination | boolean | true | Show/hide prev/next pagination controls |
sidebar | boolean | true | Show/hide the sidebar |
timestamp | boolean | true | Show/hide the last-updated timestamp |
toc | boolean | true | Show/hide the table of contents |
typesetting | 'default' | 'article' | 'default' | Text typesetting style ('article' for editorial pages) |
Layouts
Thelayout: 'full' setting stretches a page’s content to fill the entire container width — useful for landing pages or dashboards:
_meta.js
Typesetting
The'article' typesetting applies editorial font features and refined heading styles, ideal for long-form content:
_meta.js
Links
Add anhref field to any item to turn it into an external (or internal) link in the sidebar:
_meta.js
Separators
Use a key whose value hastype: 'separator' to insert a visual divider in the sidebar. The title field is optional and renders as a section label:
_meta.js
Menus
Create a dropdown menu in the navbar by settingtype: 'menu' with an items record:
_meta.js
Folders with Index Pages
To make a folder clickable (expand it and show itsindex.mdx page), add asIndexPage: true to the folder’s index file front matter:
content/fruits/index.mdx
Nested _meta.js Files
Each directory can have its own _meta.js covering only its immediate children. Top-level pages and folders are configured by the root _meta.js; subdirectory pages are configured by the _meta.js inside that subdirectory:
Global _meta.global.js File
Instead of multiple per-directory _meta.js files, you can define your entire navigation tree in a single _meta.global.js file at the project root. Folder entries must include an items field:
_meta.global.js
Good to Know
Sorting pages with ESLint
Sorting pages with ESLint
To enforce alphabetical key order in your
_meta files, add an ESLint comment at the top of the file:_meta.js
Keys must always be strings, not numbers
Keys must always be strings, not numbers
JavaScript objects sort numeric keys before string keys. A key like
1992_10_21 is silently coerced to 19921021 and moved to the front of the object — breaking your intended order. Always quote keys that look like numbers:_meta.js