next-md-blog
Markdown-first content for Next.js . Keep posts as .md / .mdx on disk. Declare any number of collections (blog, glossary, docs, changelog…) via defineCollection, render with MarkdownContent, and ship metadata, JSON-LD, RSS, sitemap, and llms.txt helpers — plus an optional CLI to scaffold routes, config, and sitemap / robots / RSS files.
Why it’s different
- Metadata lives in frontmatter — title, date, description, tags, and authors stay in the same file as the article. There is no separate per-post meta file (no
post.jsonnext topost.md) and no generated content manifest you have to treat as a second source of truth for simple blogs. - Optional site config — one TypeScript module (
next-md-blog.config.ts) for defaults and authors, not a parallel metadata tree for every post. - App Router–native — fetch posts in RSC route handlers; no extra runtime CMS required for file-based workflows.
- Small surface area — core library + initializer; you keep control of layouts and styling.
How it fits in your Next.js app
When a reader opens a post, data flows from disk through the core helpers into your page and SEO components:
Idea: your routes stay ordinary Next.js files; the library handles reading, parsing frontmatter, markdown → React, and SEO primitives.
One source of truth per post
Many toolchains introduce extra artifacts: sidecar JSON/YAML, or a generated layer (for example a build step that emits typed documents and a cache directory). next-md-blog keeps the model flat for typical blogs: one markdown file carries both prose and metadata.
You still add one optional blog-wide config file for site URL, default author, and shared author objects — that is not a per-post meta file and stays easy to reason about.
Packages
| Package | Role |
|---|---|
@next-md-blog/core | Posts, rendering, SEO helpers, feeds |
@next-md-blog/cli | Scaffold routes, config, sitemap / robots / RSS (feed.xml), optional OG; seo subcommand to add or update SEO routes; --force to overwrite |
Requirements
- Next.js
^16and React^19(peers of@next-md-blog/core) - Node.js 18+
Compared to other options (short)
| next-md-blog | Typical file-pipeline tools | Headless CMS | |
|---|---|---|---|
| Post metadata | Frontmatter in the .md/.mdx file | Often config + generated docs or sidecars | Schema in the CMS |
| Build step | Optional CLI once; runtime reads files | Often required codegen / cache dir | API + preview |
| Best for | Own your markdown in-repo | Heavy typing & content graphs | Editorial workflows, non-dev authors |
See the full Comparison page for stack-by-stack notes.
Frequently asked questions
How do I build a Markdown blog in Next.js?
Install @next-md-blog/core, keep your posts as .md / .mdx files on disk, declare a collection with defineCollection, and render it with MarkdownContent from a Server Component. The optional CLI scaffolds the routes, config, and SEO files for you. See Getting started.
Does next-md-blog work with the Next.js App Router?
Yes — it is App Router–native. You read posts inside React Server Components and route handlers; there is no separate runtime CMS or client-side data layer for file-based blogs. It targets Next.js ^16 and React ^19.
Can I write posts in MDX?
Yes. Both .md and .mdx are supported, so you can mix plain Markdown with React components in the same content folder.
Do I need a database or headless CMS?
No. Posts live as Markdown files in your repository and metadata lives in each file’s frontmatter — there is no database, no sidecar post.json, and no generated content manifest to keep in sync. See Comparison for how this differs from CMS-backed and codegen-based stacks.
Does it handle SEO, sitemap, RSS, and JSON-LD?
Yes. The core library ships metadata, JSON-LD (schemaGraph), RSS/Atom feeds, sitemap, robots, and llms.txt helpers, and the CLI can generate the matching routes. See SEO & feeds.
Does it support internationalization (i18n)?
Yes — locale segments and per-locale content folders are supported. See Internationalization and the i18n demo .
Where to go next
- Getting started — install, CLI, first routes
- CLI reference — flags,
seosubcommand,--force - Configuration —
defineSite,defineCollection, and site settings - Content & frontmatter — fields and conventions
- Internationalization — locale segments and folders
This documentation site
Published at www.next-md-blog.com . Clone the monorepo and run:
git clone https://github.com/next-md-blog/next-md-blog.git
cd next-md-blog
pnpm install
pnpm dev:docsOpen http://localhost:5101 (see docs/package.json). Production hosting: Deployment.
Live demos: demo.next-md-blog.com (single locale) · demo.i18n.next-md-blog.com (i18n).
Deploy on Vercel
Standalone starters (no monorepo clone) — see Demos and Deployment.
Single locale
i18n