Commit ef8c421
Add content negotiation for markdown documentation
Implements HTTP content negotiation in nginx to serve markdown versions of documentation pages based on the Accept header. This allows clients (like LLMs and text-based tools) to request markdown format while browsers continue to receive HTML by default.
Key features:
- Serves markdown for Accept: text/markdown, application/markdown, or text/plain
- Maintains backward compatibility (HTML is default)
- Works with existing authentication system
- Supports both index and non-index file paths
- No performance impact (uses nginx map blocks)
Content negotiation behavior:
- /docs/channels with Accept: text/markdown → serves docs/channels.md
- /docs/channels with Accept: text/html → serves docs/channels/index.html
- /docs/channels (browser default) → serves docs/channels/index.html
- /docs/channels.md (direct access) → serves docs/channels.md
Implementation:
- Added text/markdown MIME type to config/mime.types
- Added text/markdown to gzip_types for compression
- Created map blocks to detect Accept header preferences
- Updated location blocks to use content-negotiated file paths
- Fallback to HTML when markdown doesn't exist
All 211 markdown documentation files are now accessible via content negotiation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 0620c36 commit ef8c421
2 files changed
+37
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
65 | 95 | | |
66 | 96 | | |
67 | 97 | | |
| |||
231 | 261 | | |
232 | 262 | | |
233 | 263 | | |
234 | | - | |
| 264 | + | |
235 | 265 | | |
236 | | - | |
237 | | - | |
| 266 | + | |
| 267 | + | |
238 | 268 | | |
239 | 269 | | |
240 | 270 | | |
| |||
252 | 282 | | |
253 | 283 | | |
254 | 284 | | |
255 | | - | |
256 | | - | |
| 285 | + | |
| 286 | + | |
257 | 287 | | |
258 | 288 | | |
259 | 289 | | |
| |||
0 commit comments