A minimal blog template built with Next.js App Router, TypeScript, Tailwind CSS, and MDX.
- Markdown/MDX posts with YAML frontmatter
- React components inside posts (charts, widgets, etc.)
- Paginated home page
- Light / dark theme (
next-themes) - Static generation for posts and listing pages
loading/errorUI, sitemap, and robots
src/
app/ # App Router routes, layouts, loading/error
components/ # UI + MDX embeds
content/posts/ # MDX posts
lib/ # Post helpers, pagination
mdx-components.tsx # Global MDX component map
public/ # Static assets
Add posts as .mdx files in src/content/posts/.
Each file needs this frontmatter:
| Key | Value |
|---|---|
| authors | string[] |
| date | string in ISO 8601 |
| excerpt | string short summary for cards / SEO |
| thumbnail | string path or URI under public/ |
| tags | string[] |
| title | string |
Posts are ordered by date descending on the home page.
Global MDX components are registered in src/mdx-components.tsx (for example Counter and SimpleChart).
Use them directly in a post:
<Counter initial={1} />
<SimpleChart caption="Weekly reads" points={[4, 8, 6, 12]} />Or import a local component in the MDX file:
import { MyScene } from '@/components/mdx/my-scene'
<MyScene />For heavy client-only libraries (Three.js, etc.), mark the component with 'use client' and load it with next/dynamic if you need to avoid SSR.
Requires Node.js 24 LTS (see .nvmrc).
npm install
npm run devOpen http://localhost:3000.
npm run build
npm startThe home page shows a fixed page size (POSTS_PER_PAGE in src/lib/posts.ts). Later pages live at /page/2, /page/3, and so on.
Set NEXT_PUBLIC_SITE_URL to your production origin (used for metadataBase, sitemap, and robots).
Host on any Next.js platform. Vercel is the simplest path for this template.