Skip to content

Commit 6997bb9

Browse files
committed
fix: markdown rewrite excludes api/md paths
1 parent f653b03 commit 6997bb9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

next.config.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@ const nextConfig = {
2222
async rewrites() {
2323
return {
2424
beforeFiles: [
25+
// Explicit .md extension also serves markdown
26+
{
27+
source: '/:path*.md',
28+
destination: '/api/md/:path*',
29+
},
2530
// Serve markdown when Accept header prefers text/markdown
2631
// Useful for LLM agents - https://www.skeptrune.com/posts/use-the-accept-header-to-serve-markdown-instead-of-html-to-llms/
2732
{
28-
source: '/:path((?!llms.txt).*)',
33+
source: '/:path((?!llms\\.txt|api/md).*)',
2934
has: [
3035
{
3136
type: 'header',
@@ -35,11 +40,6 @@ const nextConfig = {
3540
],
3641
destination: '/api/md/:path*',
3742
},
38-
// Explicit .md extension also serves markdown
39-
{
40-
source: '/:path*.md',
41-
destination: '/api/md/:path*',
42-
},
4343
],
4444
};
4545
},

0 commit comments

Comments
 (0)