feat(api): add /api/raw/:slug endpoint for AI tools (ChatGPT, Claude, Perplexity)

- Create netlify/functions/raw.ts Netlify Function
- Returns text/plain with minimal headers for reliable AI ingestion
- Reads from dist/raw/ (production) or public/raw/ (dev/preview)
- Update CopyPageDropdown to use /api/raw/:slug for AI services
- Keep /raw/:slug.md for View as Markdown browser viewing
- Add @netlify/functions dev dependency
This commit is contained in:
Wayne Sutton
2025-12-24 00:35:02 -08:00
parent 6ac6098668
commit c98049c411
6 changed files with 147 additions and 18 deletions

View File

@@ -5,6 +5,13 @@
[build.environment]
NODE_VERSION = "20"
# API raw markdown endpoint for AI tools (ChatGPT, Claude, Perplexity)
[[redirects]]
from = "/api/raw/*"
to = "/.netlify/functions/raw/:splat"
status = 200
force = true
# Raw markdown passthrough - explicit rule prevents SPA fallback from intercepting
[[redirects]]
from = "/raw/*"