TLDR Web Dev · ARTICLES & TUTORIALS
ADDING .MD URLS FOR RAW MARKDOWN CONTENT IN NEXT.JS
Summary from the TLDR Web Dev newsletter
It's possible to add ".md" URLs to a Next.js blog to serve raw markdown content. This solution uses Next.js rewrites for efficient URL mapping, directing requests for ".md" files to a dedicated API route. The API route then retrieves the raw markdown content from Content Collections and returns it with appropriate headers, including caching instructions.