Find Neighbours

Find the neighbours of a page from the page tree

Find the neighbours of a page from the page tree, it returns the next and previous page of a given page. It is useful for implementing a footer.

For example:

Quick Startnext: Installation
Installationprevious: Quick Start, next: Concepts
Conceptsprevious: Installation

Usage

It requires a page tree and the url of page.

import { findNeighbour } from 'fumadocs-core/server';

const neighbours = findNeighbour(tree, page.url);
ParameterTypeDescription
treePageTreeThe page tree
urlstringThe url of page

Last updated on