Choose your language: English | 简体中文
A modern, fully configurable blog template built with Next.js 15, TypeScript, Tailwind CSS, and MDX. Configure once, write content, and deploy anywhere.
- Single config file:
src/config/site.config.ts
- i18n-ready: Configurable default language, Chinese (
/
) and English (/en
) by default - MDX content:
content/blog/<locale>/*.mdx
- Static export by default: production builds generate
out/
for static hosting - Built-ins: RSS/Atom/JSON feeds, dark mode, animated UI, reading time
weblog/
├── content/
│ └── blog/
│ ├── en/ # English posts
│ └── zh/ # Chinese posts
├── src/
│ ├── app/ # Routes (App Router)
│ ├── components/
│ ├── config/
│ │ └── site.config.ts
│ ├── i18n/
│ └── lib/
└── out/ # Static build output (after `pnpm build`)
- Use this repo as a template (recommended) or clone it
- Install dependencies
pnpm install
- Start dev server
pnpm dev
Edit src/config/site.config.ts
:
- Basics:
name
,title
,description
- URL: Derived from env
NEXT_PUBLIC_SITE_URL
+BASE_PATH
- Author:
author.name
,author.email
,author.bio
- Social:
social.github
,social.twitter
,social.email
- SEO:
seo.keywords
,seo.ogImage
,seo.twitterCard
- Nav:
nav.main
- Pages:
pages.home
,pages.about
i18n settings are in src/config/site.config.ts
:
locales
:['zh', 'en']
(configurable order)defaultLocale
:'zh'
(configurable: 'zh' or 'en')- URL style: Default language has no prefix, secondary language uses prefix
- Auto-deployment: GitHub Actions automatically uses your configured default language
Place MDX files under the locale folders:
content/blog/en/hello-world.mdx
content/blog/zh/hello-world.mdx
Frontmatter example:
---
title: "Your Amazing Post"
description: "Short summary for SEO"
date: "2024-01-15"
published: true
featured: false
tags: ["nextjs", "react"]
---
# Your Amazing Post
Fields: title
(required), description
(required), date
(YYYY-MM-DD), published
(default: true), featured
(default: false), tags
.
Create .env.local
in project root:
NEXT_PUBLIC_SITE_URL=https://yourdomain.com
BASE_PATH=
- For GitHub Pages (repo
Weblog
):
NEXT_PUBLIC_SITE_URL=https://<user>.github.io/Weblog
BASE_PATH=/Weblog
- For GitHub Pages (user site):
NEXT_PUBLIC_SITE_URL=https://<user>.github.io
BASE_PATH=
Notes:
- Include a leading slash in
BASE_PATH
(e.g./Weblog
), no trailing slash. - Update DNS or custom domain to match
NEXT_PUBLIC_SITE_URL
when applicable.
pnpm dev # Start development server
pnpm build # Production build (static export → ./out)
pnpm lint # ESLint
pnpm format # Prettier format
Feeds are generated from English posts and exposed at:
/rss.xml
/rss.json
/atom.xml
Set author
and seo.ogImage
in site.config.ts
for correct feed metadata.
This template defaults to static export in production. After pnpm build
, deploy the out/
directory.
- Vercel: Import repo → Build command
pnpm build
→ Outputout/
(auto-detects) - Netlify: Build command
pnpm build
→ Publish directoryout/
- GitHub Pages: Included workflow automatically handles deployment
The included .github/workflows/deploy.yml
automatically:
- Reads your
defaultLocale
fromsite.config.ts
- Places the default language content at the root (
/
) - Handles
BASE_PATH
configuration for subpath deployments
No manual configuration needed - just push to main branch!
Troubleshooting:
- Broken links → verify
BASE_PATH
in environment variables - Wrong default language → check
defaultLocale
insite.config.ts
- 404 errors → ensure content exists for both languages
See CONFIG.md for deeper customization.
Contributions are welcome. Licensed under MIT.
— Happy blogging!