refactor: migrate documentation to support multi-language structure with i18n integration
Some checks failed
Documentation Lint / lint (push) Failing after 4m46s
Some checks failed
Documentation Lint / lint (push) Failing after 4m46s
This commit is contained in:
6
documentation/src/lib/i18n.ts
Normal file
6
documentation/src/lib/i18n.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { defineI18n } from "fumadocs-core/i18n";
|
||||
|
||||
export const i18n = defineI18n({
|
||||
defaultLanguage: "en",
|
||||
languages: ["en", "fr"],
|
||||
});
|
||||
@@ -1,9 +1,11 @@
|
||||
import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';
|
||||
import type { BaseLayoutProps } from "fumadocs-ui/layouts/shared";
|
||||
import {i18n} from "@/lib/i18n";
|
||||
|
||||
export function baseOptions(): BaseLayoutProps {
|
||||
return {
|
||||
nav: {
|
||||
title: 'My App',
|
||||
},
|
||||
};
|
||||
return {
|
||||
i18n,
|
||||
nav: {
|
||||
title: "MemeGoat",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,27 +1,29 @@
|
||||
import { docs } from 'fumadocs-mdx:collections/server';
|
||||
import { type InferPageType, loader } from 'fumadocs-core/source';
|
||||
import { lucideIconsPlugin } from 'fumadocs-core/source/lucide-icons';
|
||||
import { docs } from "fumadocs-mdx:collections/server";
|
||||
import { type InferPageType, loader } from "fumadocs-core/source";
|
||||
import { lucideIconsPlugin } from "fumadocs-core/source/lucide-icons";
|
||||
import {i18n} from "@/lib/i18n";
|
||||
|
||||
// See https://fumadocs.dev/docs/headless/source-api for more info
|
||||
export const source = loader({
|
||||
baseUrl: '/docs',
|
||||
source: docs.toFumadocsSource(),
|
||||
plugins: [lucideIconsPlugin()],
|
||||
i18n,
|
||||
baseUrl: "/docs",
|
||||
source: docs.toFumadocsSource(),
|
||||
plugins: [lucideIconsPlugin()],
|
||||
});
|
||||
|
||||
export function getPageImage(page: InferPageType<typeof source>) {
|
||||
const segments = [...page.slugs, 'image.png'];
|
||||
const segments = [...page.slugs, "image.png"];
|
||||
|
||||
return {
|
||||
segments,
|
||||
url: `/og/docs/${segments.join('/')}`,
|
||||
};
|
||||
return {
|
||||
segments,
|
||||
url: `/og/docs/${segments.join("/")}`,
|
||||
};
|
||||
}
|
||||
|
||||
export async function getLLMText(page: InferPageType<typeof source>) {
|
||||
const processed = await page.data.getText('processed');
|
||||
const processed = await page.data.getText("processed");
|
||||
|
||||
return `# ${page.data.title}
|
||||
return `# ${page.data.title}
|
||||
|
||||
${processed}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user