mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-25 04:20:02 +00:00
26 lines
664 B
TypeScript
26 lines
664 B
TypeScript
import { loader, type InferPageType } from 'fumadocs-core/source';
|
|
import { docs } from 'collections/server';
|
|
import { docsContentRoute, docsRoute } from './shared';
|
|
|
|
export const source = loader({
|
|
source: docs.toFumadocsSource(),
|
|
baseUrl: docsRoute,
|
|
});
|
|
|
|
export function getPageMarkdownUrl(page: InferPageType<typeof source>) {
|
|
const segments = [...page.slugs, 'content.md'];
|
|
|
|
return {
|
|
segments,
|
|
url: `${docsContentRoute}/${segments.join('/')}`,
|
|
};
|
|
}
|
|
|
|
export async function getLLMText(page: InferPageType<typeof source>) {
|
|
const processed = await page.data.getText('processed');
|
|
|
|
return `# ${page.data.title} (${page.url})
|
|
|
|
${processed}`;
|
|
}
|