Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions app/docs/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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;
}
6 changes: 3 additions & 3 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down