getPageMap Function
Retrieves the page map structure for a given route handling nested routes.
The page map structure represents the hierarchical organization of your documentation or content, where each item can be either a page or a folder containing more pages.
Exported from nextra/page-map.
Signature
Parameters:| Name | Type | Default |
|---|---|---|
route | stringThe route path to retrieve the page map for. | "/" |
Promise<PageMapItem[]>A Promise that resolves to an array of PageMapItem objects representing the page structure
such as MdxFile, Folder and MetaJsonFile.
Warning
Throws an Error when the specified route segment cannot be found in the page map.
Example
import { getPageMap } from 'nextra/page-map'
// Get the root page map
const rootPageMap = await getPageMap()
// Get the page map for a specific route
const blogPageMap = await getPageMap('/blog')
// Get the page map for a specific language when using i18n
const enPageMap = await getPageMap('/en')