diff --git a/app/docs/docs.ts b/app/docs/docs.ts index b4ed2ad..f208925 100644 --- a/app/docs/docs.ts +++ b/app/docs/docs.ts @@ -2,6 +2,13 @@ import { readFileSync } from "fs"; import { notFound } from "next/navigation"; import { join } from "path"; +// Get the current domain based on environment +function getDomain(): string { + return process.env.NODE_ENV === 'production' + ? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}` + : 'http://localhost:3000'; +} + // List of available documents export const availableDocs = [ "getting-started", @@ -22,5 +29,10 @@ export function loadDoc(slug: string) { } catch { notFound(); } + + // Replace domain placeholder with actual domain (use environment-based domain if not provided) + const actualDomain = getDomain(); + content = content.replace(/{{DOMAIN}}/g, actualDomain); + return content; } diff --git a/docs/getting-started.md b/docs/getting-started.md index cecd706..f2fd29e 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -3,7 +3,7 @@ Try requesting this page like an agent would: ``` - curl -H "Accept: text/markdown" https://markdown-to-agents.vercel.app/docs/getting-started + curl -H "Accept: text/markdown" {{DOMAIN}}/docs/getting-started ``` ## Demo content @@ -18,8 +18,8 @@ Before you begin, ensure you have the following installed: 1. Clone the repository: ```bash - git clone https://github.com/example/project.git - cd project + git clone https://github.com/vercel-labs/markdown-to-agents + cd markdown-to-agents ``` 2. Install dependencies: