mirror of
https://github.com/vercel/ai-elements.git
synced 2026-09-14 19:48:26 +08:00
cf793dd446
* Remove microfrontends * Remove /elements subpath, update URL * Fix local paths * Remove custom AI SDK navbar * Update global.css * Restore docs in path * Restore Geistdocs homepage * Split up docs, components and examples * New routes for components and examples * IA fixes * Update hero, start adding components to homepage * Experimenting with hero * Update pnpm-lock.yaml * Add new docs * Update geistdocs.tsx * Update examples, add new IDE example * Create source-code.tsx * Cleanup ide.mdx * Cleanup examples * Update homepage content * Misc fixes * Update elements-installer.tsx * Update meta.json * Deprecate Loader component for shadcn/ui Spinner * Add changeset files * Update homepage and templates * Update code-block.tsx * Misc fixes * Update callout.tsx * Remove hero badge * Resolves #328 * Build fixes * Update README.md
68 lines
1.6 KiB
TypeScript
68 lines
1.6 KiB
TypeScript
import { type InferPageType, loader } from "fumadocs-core/source";
|
|
import { lucideIconsPlugin } from "fumadocs-core/source/lucide-icons";
|
|
import { components, docs, examples } from "@/.source/server";
|
|
import { basePath } from "@/geistdocs";
|
|
import { i18n } from "./i18n";
|
|
|
|
// See https://fumadocs.dev/docs/headless/source-api for more info
|
|
export const docsSource = loader({
|
|
i18n,
|
|
baseUrl: "/docs",
|
|
source: docs.toFumadocsSource(),
|
|
plugins: [lucideIconsPlugin()],
|
|
});
|
|
|
|
export const componentsSource = loader({
|
|
i18n,
|
|
baseUrl: "/components",
|
|
source: components.toFumadocsSource(),
|
|
plugins: [lucideIconsPlugin()],
|
|
});
|
|
|
|
export const examplesSource = loader({
|
|
i18n,
|
|
baseUrl: "/examples",
|
|
source: examples.toFumadocsSource(),
|
|
plugins: [lucideIconsPlugin()],
|
|
});
|
|
|
|
export const source = loader({
|
|
i18n,
|
|
baseUrl: "/",
|
|
source: {
|
|
files: [
|
|
...docs.toFumadocsSource().files,
|
|
...components.toFumadocsSource().files,
|
|
...examples.toFumadocsSource().files,
|
|
],
|
|
},
|
|
plugins: [lucideIconsPlugin()],
|
|
});
|
|
|
|
export const getPageImage = (
|
|
page: InferPageType<
|
|
typeof docsSource | typeof componentsSource | typeof examplesSource
|
|
>
|
|
) => {
|
|
const segments = [...page.slugs, "image.png"];
|
|
|
|
return {
|
|
segments,
|
|
url: basePath
|
|
? `${basePath}/og/${segments.join("/")}`
|
|
: `/og/${segments.join("/")}`,
|
|
};
|
|
};
|
|
|
|
export const getLLMText = async (
|
|
page: InferPageType<
|
|
typeof docsSource | typeof componentsSource | typeof examplesSource
|
|
>
|
|
) => {
|
|
const processed = await page.data.getText("processed");
|
|
|
|
return `# ${page.data.title}
|
|
|
|
${processed}`;
|
|
};
|