Menu

1 / 2

How to Add a Blog to Your Next.js Site with MDX (and Keep It Alive)

DEV Community: react·Roy Levy·3 days ago
#7qy6cVoz
#devtoreact#devto#dev#next#slug
Reading 0:00
15s threshold

Adding a blog to a Next.js site takes an afternoon.

Keeping it alive takes a habit.

This guide covers both. First, a small, boring setup that will not need a rewrite in six months: posts as MDX files in your repo, static pages, proper metadata, and a sitemap. Then, what actually stops most product blogs at four posts, and how to get past it.

Tested on: Next.js 16.4 (App Router), React 19.2, next-mdx-remote 6.0, gray-matter 4.0, remark-gfm 4.0, in November 2026. I built a fresh app with exactly the code below, ran next build , and checked the output. If you are on another version, check the Next.js MDX guide for changes.

Pick the setup first

Next.js has two common ways to do MDX.

@next/mdx turns .mdx files into pages or importable components. It is the official route and works well.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.