mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-21 19:31:57 +00:00
fix: use beforeFiles (#8276)
This commit is contained in:
@@ -20,26 +20,28 @@ const nextConfig = {
|
||||
reactCompiler: true,
|
||||
},
|
||||
async rewrites() {
|
||||
return [
|
||||
// Serve markdown when Accept header prefers text/markdown
|
||||
// Useful for LLM agents - https://www.skeptrune.com/posts/use-the-accept-header-to-serve-markdown-instead-of-html-to-llms/
|
||||
{
|
||||
source: '/:path*',
|
||||
has: [
|
||||
{
|
||||
type: 'header',
|
||||
key: 'accept',
|
||||
value: '(.*text/markdown.*)',
|
||||
},
|
||||
],
|
||||
destination: '/api/md/:path*',
|
||||
},
|
||||
// Explicit .md extension also serves markdown
|
||||
{
|
||||
source: '/:path*.md',
|
||||
destination: '/api/md/:path*',
|
||||
},
|
||||
];
|
||||
return {
|
||||
beforeFiles: [
|
||||
// Serve markdown when Accept header prefers text/markdown
|
||||
// Useful for LLM agents - https://www.skeptrune.com/posts/use-the-accept-header-to-serve-markdown-instead-of-html-to-llms/
|
||||
{
|
||||
source: '/:path((?!llms.txt).*)',
|
||||
has: [
|
||||
{
|
||||
type: 'header',
|
||||
key: 'accept',
|
||||
value: '(.*text/markdown.*)',
|
||||
},
|
||||
],
|
||||
destination: '/api/md/:path*',
|
||||
},
|
||||
// Explicit .md extension also serves markdown
|
||||
{
|
||||
source: '/:path*.md',
|
||||
destination: '/api/md/:path*',
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
env: {},
|
||||
webpack: (config, {dev, isServer, ...options}) => {
|
||||
|
||||
Reference in New Issue
Block a user