(req: NextRequest)
| 102 | }; |
| 103 | |
| 104 | const isMarkdownRequest = (req: NextRequest): boolean => { |
| 105 | const { pathname } = req.nextUrl; |
| 106 | |
| 107 | if ( |
| 108 | pathname.startsWith('/api/md/') || |
| 109 | MARKDOWN_PAGE_PATHS.includes(pathname) |
| 110 | ) { |
| 111 | return true; |
| 112 | } |
| 113 | |
| 114 | if (!pathname.startsWith(POSTS_PREFIX)) { |
| 115 | return false; |
| 116 | } |
| 117 | |
| 118 | const id = pathname.slice(POSTS_PREFIX.length); |
| 119 | |
| 120 | return ( |
| 121 | !!id && |
| 122 | !id.includes('/') && |
| 123 | (id.endsWith('.md') || acceptsMarkdown(req.headers.get('accept'))) |
| 124 | ); |
| 125 | }; |
| 126 | |
| 127 | // Prerendered pages are cached per path, so the shell has to be part of the |
| 128 | // path: the mirror renders the laptop chrome (rail + floating card) in the |
no test coverage detected