37 lines
970 B
TypeScript
37 lines
970 B
TypeScript
import { docs } from 'collections/server';
|
|
import { loader } from 'fumadocs-core/source';
|
|
import { lucideIconsPlugin } from 'fumadocs-core/source/lucide-icons';
|
|
import { docsContentRoute, docsImageRoute, docsRoute } from './shared';
|
|
|
|
export const source = loader({
|
|
baseUrl: docsRoute,
|
|
source: docs.toFumadocsSource(),
|
|
plugins: [lucideIconsPlugin()],
|
|
});
|
|
|
|
export function getPageImage(page: (typeof source)['$inferPage']) {
|
|
const segments = [...page.slugs, 'image.png'];
|
|
|
|
return {
|
|
segments,
|
|
url: `${docsImageRoute}/${segments.join('/')}`,
|
|
};
|
|
}
|
|
|
|
export function getPageMarkdownUrl(page: (typeof source)['$inferPage']) {
|
|
const segments = [...page.slugs, 'content.md'];
|
|
|
|
return {
|
|
segments,
|
|
url: `${docsContentRoute}/${segments.join('/')}`,
|
|
};
|
|
}
|
|
|
|
export async function getLLMText(page: (typeof source)['$inferPage']) {
|
|
const processed = await page.data.getText('processed');
|
|
|
|
return `# ${page.data.title} (${page.url})
|
|
|
|
${processed}`;
|
|
}
|