Fumadocs

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.

Usage

It requires a page tree and the url of page.

import { findNeighbour } from 'fumadocs-core/server';
import { pageTree } from '@/app/source';
 
const neighbours = findNeighbour(pageTree, '/url/to/page');
ParameterTypeDescription
treePageTreeThe page tree
urlstringThe url of page

Last updated on

On this page

Edit on Github