File tree Expand file tree Collapse file tree 1 file changed +22
-20
lines changed
Expand file tree Collapse file tree 1 file changed +22
-20
lines changed Original file line number Diff line number Diff line change @@ -20,26 +20,28 @@ const nextConfig = {
2020 reactCompiler : true ,
2121 } ,
2222 async rewrites ( ) {
23- return [
24- // Serve markdown when Accept header prefers text/markdown
25- // Useful for LLM agents - https://www.skeptrune.com/posts/use-the-accept-header-to-serve-markdown-instead-of-html-to-llms/
26- {
27- source : '/:path*' ,
28- has : [
29- {
30- type : 'header' ,
31- key : 'accept' ,
32- value : '(.*text/markdown.*)' ,
33- } ,
34- ] ,
35- destination : '/api/md/:path*' ,
36- } ,
37- // Explicit .md extension also serves markdown
38- {
39- source : '/:path*.md' ,
40- destination : '/api/md/:path*' ,
41- } ,
42- ] ;
23+ return {
24+ beforeFiles : [
25+ // Serve markdown when Accept header prefers text/markdown
26+ // Useful for LLM agents - https://www.skeptrune.com/posts/use-the-accept-header-to-serve-markdown-instead-of-html-to-llms/
27+ {
28+ source : '/:path((?!llms.txt).*)' ,
29+ has : [
30+ {
31+ type : 'header' ,
32+ key : 'accept' ,
33+ value : '(.*text/markdown.*)' ,
34+ } ,
35+ ] ,
36+ destination : '/api/md/:path*' ,
37+ } ,
38+ // Explicit .md extension also serves markdown
39+ {
40+ source : '/:path*.md' ,
41+ destination : '/api/md/:path*' ,
42+ } ,
43+ ] ,
44+ } ;
4345 } ,
4446 env : { } ,
4547 webpack : ( config , { dev, isServer, ...options } ) => {
You can’t perform that action at this time.
0 commit comments