feat: Add markdown (.md) support

Author: minhdqdevCreated Mar 24, 2026Updated Mar 24, 2026

Description

I want to enhance the project to support rendering raw Markdown (.md) files.

Why is this better?

Markdown files are less strict than .mdx files because they do not need to render JSX components. Therefore, issues like unclosed HTML tags remain valid in .md files.

Additionally, .md files are more common than .mdx. For example, .md files are supported by many popular static site generators and note-taking apps.

Proposed change in contentlayer.config.ts:

typescript
// ...
filePathPattern: 'blog/**/*.{md,mdx}', // old value: blog/**/*.mdx
// ...

This should not break anything for the following reasons:

  1. Same rendering pipeline: It still uses the same contentlayer2 library to process both .mdx and .md files.
  2. Backward compatible: Adding .md support does not change how .mdx files are processed.
  3. Already proven: My website [minhdq.dev](https://minhdq.dev) is currently using both .md and .mdx with contentlayer2 v0.5.5 without issues.

Related issues:

Source: timlrx/tailwind-nextjs-starter-blog