Skip to content

sabertazimi/blog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Next.js Blog Starter

An awesome blog system based on Next.js.

Author LICENSE Top Language

CI CodeQL Vitest Coverage

Default Nature
Home Home Nature
MDX MDX Nature
Code Code Nature

✨ Features

Content & UX

  • Rich MDX Support - GFM, KaTeX math, admonitions, emoji shortcodes, Shiki-based syntax highlighting, live code editor with Sandpack
  • Modern UI/UX - Dark mode, smooth animations, command menu (⌘K), responsive design, progress indicators
  • Advanced Navigation - Auto-generated TOC with active tracking, previous/next posts, tag filtering, search
  • Social & Interactive - Giscus comments, share buttons, GitHub integration
  • Bilingual (i18n) - Full English/Chinese support with locale-specific routing

LLM-Ready

  • AI Agent Actions - One-click "Read with Claude" or "Read with ChatGPT" to open articles in AI assistants with context
  • llms.txt API - Auto-generated structured feed for LLM consumption at /llms.txt

Developer Experience

  • Modern Stack - Next.js App Router + Turbopack, React Compiler, TypeScript strict mode
  • Comprehensive Testing - Vitest (unit), Playwright (E2E), Testing Library
  • Code Quality - ESLint, Stylelint, Prettier, CI/CD with GitHub Actions
  • Performance - Automatic code splitting, image optimization, Rust-based builds
  • SEO Ready - Meta tags, sitemap, robots.txt, Open Graph, Twitter Cards

πŸ“‘ Post Template

.yaml front matter + .mdx body:

---
layout: post
title: 'Your Post Title'
description: 'Your post description'
author: 'Your Name'
date: 2026-01-01
thumbnail: '/thumbnails/your-thumbnail.jpg'
tags:
  - Your Tag 1
  - Your Tag 2
  - Your Tag 3
---

# Your Post Title

## Introduction

Your content here...

## Math Support

Inline math: $E = mc^2$

Block math:

$$
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
$$

## Admonitions

:::note
This is a note admonition.
:::

:::tip
This is a tip admonition.
:::

:::warning
This is a warning admonition.
:::

πŸš€ Quick Start

Prerequisites

  • Node.js 18.17 or later
  • pnpm 10 or later

Installation

git clone https://github.com/sabertazimi/blog
cd blog
pnpm install

Development

pnpm dev

Open the source code and start editing!

Your site is now running at http://localhost:3000!

Build

# Build for production
pnpm build

# Start production server
pnpm serve

🌠 Deployment

Deploy to Vercel

Build for production:

pnpm build

The optimized production build will be in the .next folder.

πŸ”§ Configuration

Site Configuration

Edit src/lib/site.ts to customize your blog:

export const site = {
  author: 'Your Name',
  url: 'https://yourblog.com',
  // ... more settings
}

i18n Configuration

Configure supported locales in src/i18n/routing.ts:

export const routing = defineRouting({
  locales: ['en-US', 'zh-CN'],
  defaultLocale: 'en-US',
  localePrefix: 'always',
})

Add translations in messages/[locale].json:

{
  "site": {
    "title": "Your Blog Title",
    "description": "Your blog description"
  },
  "common": {
    "loading": "Loading...",
    "backToTop": "Back to top"
  }
}

Organize MDX posts by locale in content/[locale]/:

content/
β”œβ”€β”€ en-US/
β”‚   β”œβ”€β”€ my-first-post.mdx
β”‚   └── ...
└── zh-CN/
    β”œβ”€β”€ my-first-post.mdx
    └── ...

Theme Customization

The blog uses Tailwind CSS with custom CSS variables. Edit src/app/globals.css to customize colors:

:root {
  --background: oklch(100% 0 0deg);
  --foreground: oklch(14.5% 0 0deg);
  --primary: oklch(20.5% 0 0deg);
  /* ... more colors */
}

.dark {
  --background: oklch(14.5% 0 0deg);
  --foreground: oklch(98.5% 0 0deg);
  /* ... more colors */
}

Nature theme:

pnpm dlx shadcn@latest add https://tweakcn.com/r/themes/nature.json

Claude theme:

pnpm dlx shadcn@latest add https://tweakcn.com/r/themes/claude.json

Shadcn UI Registries

The project includes multiple component registries in components.json:

You can add components from these registries:

pnpm dlx shadcn@latest add @magicui/morphing-text
pnpm dlx shadcn@latest add @animate-ui/gravity-stars

MDX Components

Customize MDX components in src/components/post-content.tsx:

const mdxComponents = {
  aside: MDXAdmonition,
  img: MDXImage,
  pre: MDXCode,
  Button,
  Editor: MDXEditor,
  // Add your custom components here
}

πŸ“‚ Project Structure

.
β”œβ”€β”€ node_modules/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                       # Next.js App Router pages
β”‚   β”‚   β”œβ”€β”€ [locale]/              # Locale-based routing
β”‚   β”‚   β”‚   β”œβ”€β”€ about/             # About page
β”‚   β”‚   β”‚   β”œβ”€β”€ post/[slug]/       # Dynamic post pages
β”‚   β”‚   β”‚   β”œβ”€β”€ posts/             # All posts page
β”‚   β”‚   β”‚   β”œβ”€β”€ tag/[tagName]/     # Tag filter pages
β”‚   β”‚   β”‚   β”œβ”€β”€ layout.tsx         # Locale layout
β”‚   β”‚   β”‚   β”œβ”€β”€ page.tsx           # Home page
β”‚   β”‚   β”‚   └── not-found.tsx      # 404 page
β”‚   β”‚   β”œβ”€β”€ globals.css            # Global styles
β”‚   β”‚   β”œβ”€β”€ providers.tsx          # Context providers
β”‚   β”‚   β”œβ”€β”€ robots.ts              # robots.txt generation
β”‚   β”‚   └── sitemap.ts             # Sitemap generation
β”‚   β”œβ”€β”€ components/                # React components
β”‚   β”‚   β”œβ”€β”€ ui/                    # Shadcn UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ button.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ card.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ dialog.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ skeleton.tsx
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€β”€ language-switcher.tsx  # Language switcher
β”‚   β”‚   β”œβ”€β”€ mdx-code.tsx           # Code block with Shiki
β”‚   β”‚   β”œβ”€β”€ mdx-editor.tsx         # Live code editor with Sandpack
β”‚   β”‚   β”œβ”€β”€ mdx-image.tsx          # Optimized image component
β”‚   β”‚   β”œβ”€β”€ post-card.tsx          # Post card component
β”‚   β”‚   β”œβ”€β”€ post-content.tsx       # MDX content renderer
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ i18n/                      # Internationalization
β”‚   β”‚   β”œβ”€β”€ routing.ts             # i18n routing config
β”‚   β”‚   β”œβ”€β”€ request.ts             # Request config
β”‚   β”‚   β”œβ”€β”€ navigation.ts          # Navigation helpers
β”‚   β”‚   └── utils.ts               # i18n utilities
β”‚   β”œβ”€β”€ layouts/                   # Layout components
β”‚   β”‚   └── default-layout.tsx
β”‚   β”œβ”€β”€ lib/                       # Utility functions
β”‚   β”‚   β”œβ”€β”€ get-posts-data.ts      # MDX processing
β”‚   β”‚   β”œβ”€β”€ utils.ts               # Helper functions
β”‚   β”‚   β”œβ”€β”€ get-routes.ts          # Route generation
β”‚   β”‚   β”œβ”€β”€ seo.ts                 # SEO utilities
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ types/                     # TypeScript type definitions
β”‚   β”‚   β”œβ”€β”€ index.d.ts
β”‚   β”‚   └── i18n.ts
β”‚   └── proxy.ts                   # next-intl middleware
β”œβ”€β”€ content/                       # Blog posts (.mdx files)
β”‚   β”œβ”€β”€ en-US/                     # English posts
β”‚   β”‚   β”œβ”€β”€ post1.mdx
β”‚   β”‚   └── ...
β”‚   └── zh-CN/                     # Chinese posts
β”‚       β”œβ”€β”€ post1.mdx
β”‚       └── ...
β”œβ”€β”€ messages/                      # i18n translation files
β”‚   β”œβ”€β”€ en-US.json
β”‚   └── zh-CN.json
β”œβ”€β”€ public/                        # Static assets
β”‚   β”œβ”€β”€ fonts/
β”‚   β”œβ”€β”€ images/
β”‚   β”œβ”€β”€ thumbnails/
β”‚   └── ...
β”œβ”€β”€ e2e/                           # Playwright E2E tests
β”‚   β”œβ”€β”€ home.spec.ts
β”‚   β”œβ”€β”€ i18n.spec.ts
β”‚   └── ...
β”œβ”€β”€ .github/                       # GitHub workflows
β”‚   └── workflows/
β”‚       β”œβ”€β”€ ci.yml
β”‚       └── codeql-analysis.yml
β”œβ”€β”€ .gitignore
β”œβ”€β”€ .prettierrc.json
β”œβ”€β”€ components.json                # Shadcn UI config
β”œβ”€β”€ eslint.config.mjs              # ESLint Flat Config
β”œβ”€β”€ next.config.ts                 # Next.js configuration
β”œβ”€β”€ package.json
β”œβ”€β”€ playwright.config.ts           # Playwright configuration
β”œβ”€β”€ postcss.config.mjs             # PostCSS configuration
β”œβ”€β”€ tsconfig.json                  # TypeScript configuration
β”œβ”€β”€ vitest.config.mts              # Vitest configuration
β”œβ”€β”€ LICENSE
└── README.md

Key Directories

  1. src/app/[locale]/: Locale-based Next.js App Router pages with i18n support
  2. src/components/: Reusable React components
  3. src/components/ui/: Shadcn UI base components
  4. src/i18n/: Internationalization configuration and utilities
  5. src/lib/: Utility functions and data fetching logic
  6. src/types/: TypeScript type definitions
  7. content/: Blog posts in MDX format (organized by locale)
  8. messages/: i18n translation JSON files
  9. public/: Static assets (images, fonts, etc.)
  10. e2e/: End-to-end tests with Playwright

πŸ“¦ Tech Stack

Core Package

Styling Toolkit

Content Helper

Testing Library

Development Tool

🚧 Caveats

  • import and export statements cannot be used inside MDX files due to next-mdx-remote limitations.
  • If you need custom components in MDX, add them to src/components/post-content.tsx.
  • See explanation for details.

πŸ”– Contact

GitHub Email X