靜態導出
使用 Fumadocs 啟用靜態導出
概覽
Fumadocs 完全兼容 Next.js 靜態導出,允許您將應用程序導出為不需要 Node.js 伺服器的靜態 HTML 站點。
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
output: 'export',
};搜尋
雲解決方案
由於搜尋功能由遠程伺服器提供支持,靜態導出無需配置即可工作。
內置搜尋
Orama 搜尋的預設搜尋配置使用路由處理器,靜態導出不支持這種方式。
相反,您可以按照 Orama 搜尋 指南靜態構建搜尋索引。 並從 Root Provider 在搜尋客戶端上啟用靜態模式:
import { RootProvider } from 'fumadocs-ui/provider';
import type { ReactNode } from 'react';
export default function RootLayout({ children }: { children: ReactNode }) {
return (
<html lang="en" suppressHydrationWarning>
<body>
<RootProvider
search={{
options: {
type: 'static',
},
}}
>
{children}
</RootProvider>
</body>
</html>
);
}這允許路由處理器被靜態緩存到單個文件中,搜尋將在瀏覽器中計算。
MkSaaS文檔