mirror of
https://github.com/vercel/eve.git
synced 2026-09-20 05:35:39 +08:00
f44e16a3e5
Co-authored-by: Casey Gowrie <ctgowrie@gmail.com> Co-authored-by: Allen Zhou <46854522+allenzhou101@users.noreply.github.com> Co-authored-by: Rui Conti <ruiconti@gmail.com> Co-authored-by: JJ Kasper <jj@jjsweb.site> Co-authored-by: Timo Lins <1440854+timolins@users.noreply.github.com> Co-authored-by: Felix Arntz <3531426+felixarntz@users.noreply.github.com> Co-authored-by: Shar Dara <2982650+darafsheh@users.noreply.github.com> Co-authored-by: John Phamous <johnphammail@gmail.com>
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { createSource, type FumadocsCollection } from "@vercel/geistdocs/source";
|
|
import { docs } from "@/.source/server";
|
|
import { config } from "./config";
|
|
|
|
// If a page has a `url:` frontmatter field, use it as the routing slug so
|
|
// a file like channels/README.md can render at /docs/channels without being
|
|
// renamed on disk.
|
|
const docsSource = docs.toFumadocsSource();
|
|
|
|
const baseSource = {
|
|
files: [...docsSource.files],
|
|
};
|
|
|
|
for (const file of baseSource.files) {
|
|
if (file.type !== "page") continue;
|
|
const override = (file.data as { url?: unknown } | undefined)?.url;
|
|
if (typeof override !== "string" || !override.startsWith("/")) continue;
|
|
(file as { slugs?: string[] }).slugs = override.slice(1).split("/").filter(Boolean);
|
|
}
|
|
|
|
const mergedDocs: FumadocsCollection = {
|
|
toFumadocsSource: () => baseSource,
|
|
};
|
|
|
|
export const geistdocsSource = createSource({
|
|
docs: mergedDocs,
|
|
config,
|
|
id: "docs",
|
|
label: "Docs",
|
|
});
|
|
|
|
export const source = geistdocsSource.source;
|
|
export const getPageImage = geistdocsSource.getPageImage;
|
|
export const getLLMText = geistdocsSource.getPageMarkdown;
|