feat: AI agent redirect middleware + llms-txt plugin#374
feat: AI agent redirect middleware + llms-txt plugin#374katieschilling wants to merge 1 commit intomainfrom
Conversation
Add Vercel Edge middleware that detects AI agents by User-Agent and Accept header, redirecting them to .md versions of blog pages. Add @signalwire/docusaurus-plugin-llms-txt to generate llms.txt and markdown files at build time for AI consumption. Assisted-by: Claude Opus 4.6 via Claude Code Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
|
|
||
| export const config = { | ||
| matcher: "/blog/:path*", | ||
| }; |
There was a problem hiding this comment.
Middleware redirects non-post blog paths to likely nonexistent files
Medium Severity
The config.matcher of "/blog/:path*" causes the middleware to redirect AI agents on all blog sub-paths — including tag listing pages (/blog/tags/), specific tag pages (/blog/tags/foo/), and pagination pages (/blog/page/2/) — to .md equivalents like /blog/tags.md or /blog/page/2.md. The PR description states the plugin generates "per-post .md files", so these non-post paths likely have no corresponding .md file, resulting in AI agents receiving a 307 redirect followed by a 404.


Summary
Accept: text/markdown) and 307-redirects them to.mdversions of blog pages@signalwire/docusaurus-plugin-llms-txt(same plugin used in tigris-os-docs) to generatellms.txt,llms-full.txt, and per-post.mdfiles at build timeLinkheader pointing tollms.txtfor discoveryReference: tigrisdata/tigris-os-docs#398
Test plan
npm run buildsucceeds and generatesbuild/llms.txtand.mdfilescurl -H "User-Agent: ClaudeBot" -v https://tigrisdata.com/blog/Linkheader🤖 Generated with Claude Code
Note
Medium Risk
Adds edge middleware that alters request/response behavior under
/blog, which could affect SEO/caching and any clients expecting existing redirects/headers. Also introduces a new build-time plugin and dependencies that may change generated artifacts and deployment output.Overview
Adds the
@signalwire/docusaurus-plugin-llms-txtplugin to generatellms.txt,llms-full.txt, and per-blog-post.mdoutputs during the Docusaurus build.Introduces a Vercel Edge
middleware.mjsscoped to/blog/*that detects AI agents (byAccept: text/markdownor knownUser-Agentpatterns) and 307-redirects them to the corresponding.mdURL; normal requests pass through but receive aLinkheader advertising/blog/llms.txt.Written by Cursor Bugbot for commit f5fc3bb. This will update automatically on new commits. Configure here.