Fumadocs

查找邻居页面

从页面树中查找页面的邻居页面

从页面树中查找页面的邻居页面,它返回给定页面的下一个和前一个页面。这对于实现页脚很有用。

用法

它需要页面树和页面的 URL。

import { findNeighbour } from 'fumadocs-core/server';
import { pageTree } from '@/lib/source';

const neighbours = findNeighbour(pageTree, '/url/to/page');
参数类型描述
treePageTree页面树
urlstring页面的 URL

How is this guide?

Last updated on

On this page