diff --git a/apps/docs/app/docs/[[...slug]]/page.tsx b/apps/docs/app/docs/[[...slug]]/page.tsx index 107e020..8df18d5 100644 --- a/apps/docs/app/docs/[[...slug]]/page.tsx +++ b/apps/docs/app/docs/[[...slug]]/page.tsx @@ -1,4 +1,5 @@ -import { getPageImage, source } from "@/lib/source"; +import { CopyMarkdownButton } from "@/components/copy-markdown-button"; +import { getPageImage, getLLMText, source } from "@/lib/source"; import { getMDXComponents } from "@/mdx-components"; import { DocsBody, @@ -16,10 +17,14 @@ export default async function Page(props: PageProps<"/docs/[[...slug]]">) { if (!page) notFound(); const MDX = page.data.body; + const markdown = await getLLMText(page); return ( - {page.data.title} +
+ {page.data.title} + +
{page.data.description} Dokploy is an open-source, self-hostable Platform as a Service (PaaS) that simplifies the deployment and management of applications, databases, and services.", + "", + "## Docs", + "", + ...pages.map( + (page) => + `- [${page.data.title}](${baseUrl}${page.url})${page.data.description ? `: ${page.data.description}` : ""}`, + ), + "", + "## Full Documentation", + "", + `- [llms-full.txt](${baseUrl}/llms-full.txt)`, + ]; + + return new Response(lines.join("\n")); +} diff --git a/apps/docs/app/robots.ts b/apps/docs/app/robots.ts new file mode 100644 index 0000000..3b00704 --- /dev/null +++ b/apps/docs/app/robots.ts @@ -0,0 +1,11 @@ +import type { MetadataRoute } from "next"; + +export default function robots(): MetadataRoute.Robots { + return { + rules: { + userAgent: "*", + allow: "/", + }, + sitemap: "https://docs.dokploy.com/sitemap.xml", + }; +} diff --git a/apps/docs/app/sitemap.ts b/apps/docs/app/sitemap.ts new file mode 100644 index 0000000..8f29ebd --- /dev/null +++ b/apps/docs/app/sitemap.ts @@ -0,0 +1,23 @@ +import { source } from "@/lib/source"; +import type { MetadataRoute } from "next"; + +const baseUrl = "https://docs.dokploy.com"; + +export default function sitemap(): MetadataRoute.Sitemap { + const pages = source.getPages().map((page) => ({ + url: `${baseUrl}${page.url}`, + lastModified: new Date(), + changeFrequency: "weekly" as const, + priority: 0.7, + })); + + return [ + { + url: baseUrl, + lastModified: new Date(), + changeFrequency: "monthly", + priority: 1, + }, + ...pages, + ]; +} diff --git a/apps/docs/components/copy-markdown-button.tsx b/apps/docs/components/copy-markdown-button.tsx new file mode 100644 index 0000000..eeea632 --- /dev/null +++ b/apps/docs/components/copy-markdown-button.tsx @@ -0,0 +1,30 @@ +"use client"; + +import { useCopyButton } from "fumadocs-ui/utils/use-copy-button"; +import { Check, Copy } from "lucide-react"; + +export function CopyMarkdownButton({ markdown }: { markdown: string }) { + const [checked, onClick] = useCopyButton(() => { + navigator.clipboard.writeText(markdown); + }); + + return ( + + ); +}