Skip to content

dnc1994/blog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Synthesist in the Shell

A blog by Linghao Zhang, built with Next.js 15 and modern web technologies.

Tech Stack

  • Framework: Next.js 15 (App Directory, Static Export)
  • Language: TypeScript
  • Styling: Tailwind CSS 4.0 beta
  • Content: MDX for rich content
  • Syntax Highlighting: Shiki
  • Math: KaTeX
  • Fonts: Inter Variable, Lora Italic Variable, Iosevka Fixed Curly
  • Deployment: Cloudflare Pages
  • CI/CD: GitHub Actions

Features

  • โœจ Modern, clean design with smooth view transitions
  • ๐Ÿ“ฑ Fully responsive layout
  • ๐ŸŽจ Custom typography with variable fonts
  • ๐ŸŒˆ Elegant color scheme (rurikon palette)
  • ๐Ÿ“ MDX support for rich content
  • ๐Ÿ” Syntax highlighting for code blocks
  • ๐Ÿงฎ Math rendering support
  • ๐Ÿท๏ธ Tag system with filtering
  • ๐Ÿ“ธ Photography gallery with lightbox
  • ๐Ÿ“ก Auto-generated RSS feed
  • โšก Optimized static site with CDN delivery
  • ๐Ÿš€ Automated deployments

Getting Started

Prerequisites

  • Node.js 16 or later
  • pnpm, yarn, or npm

Installation

# Install dependencies
pnpm install
# or
yarn install
# or
npm install

Development

# Run development server
pnpm dev
# or
yarn dev
# or
npm run dev

Open http://localhost:3000 to view the blog.

Build

# Build for production (includes RSS generation)
npm run build

The build outputs to the dist/ directory and includes:

  • Static HTML/CSS/JS files
  • Auto-generated RSS feed at /feed.xml
  • Optimized images and assets

Additional Commands

# Generate RSS feed only
npm run rss

# Deploy to Cloudflare Pages (preview)
npm run deploy

# Deploy to Cloudflare Pages (production)
npm run deploy:prod

# Lint code
npm run lint

Project Structure

.
โ”œโ”€โ”€ app/                     # Next.js app directory
โ”‚   โ”œโ”€โ”€ _fonts/             # Custom font files
โ”‚   โ”œโ”€โ”€ globals.css         # Global styles
โ”‚   โ”œโ”€โ”€ layout.tsx          # Root layout
โ”‚   โ”œโ”€โ”€ page.mdx            # Home page
โ”‚   โ”œโ”€โ”€ posts/              # Blog posts
โ”‚   โ”‚   โ”œโ”€โ”€ page.tsx        # Posts index
โ”‚   โ”‚   โ”œโ”€โ”€ [slug]/         # Dynamic post pages
โ”‚   โ”‚   โ””โ”€โ”€ _articles/      # Post content (MDX)
โ”‚   โ”œโ”€โ”€ notes/              # Reading notes
โ”‚   โ”‚   โ”œโ”€โ”€ page.tsx        # Notes index
โ”‚   โ”‚   โ”œโ”€โ”€ [slug]/         # Dynamic note pages
โ”‚   โ”‚   โ””โ”€โ”€ _articles/      # Note content (MDX)
โ”‚   โ”œโ”€โ”€ misc/               # Miscellaneous articles
โ”‚   โ”‚   โ”œโ”€โ”€ page.tsx        # Misc index
โ”‚   โ”‚   โ”œโ”€โ”€ [slug]/         # Dynamic misc pages
โ”‚   โ”‚   โ””โ”€โ”€ _articles/      # Misc content (MDX)
โ”‚   โ”œโ”€โ”€ gallery/            # Photography gallery
โ”‚   โ”‚   โ”œโ”€โ”€ page.tsx        # Gallery page
โ”‚   โ”‚   โ”œโ”€โ”€ gallery-grid.tsx # Lightbox component
โ”‚   โ”‚   โ””โ”€โ”€ data.ts         # Photo data
โ”‚   โ””โ”€โ”€ tags/               # Tag system
โ”‚       โ””โ”€โ”€ all/            # Tag filtering page
โ”œโ”€โ”€ components/             # React components
โ”‚   โ”œโ”€โ”€ navbar.tsx          # Navigation
โ”‚   โ”œโ”€โ”€ tag.tsx             # Tag component
โ”‚   โ””โ”€โ”€ ...                 # Other components
โ”œโ”€โ”€ lib/                    # Utilities
โ”‚   โ””โ”€โ”€ tags.ts             # Tag management
โ”œโ”€โ”€ scripts/                # Build scripts
โ”‚   โ””โ”€โ”€ generate-rss.mjs    # RSS generation
โ”œโ”€โ”€ public/                 # Static assets
โ”œโ”€โ”€ dist/                   # Build output
โ”œโ”€โ”€ mdx-components.tsx      # MDX component config
โ”œโ”€โ”€ next.config.ts          # Next.js config
โ”œโ”€โ”€ wrangler.toml           # Cloudflare config
โ””โ”€โ”€ .github/workflows/      # CI/CD pipelines
    โ””โ”€โ”€ deploy.yml          # Deployment workflow

Content Management

All content is written in MDX format, combining Markdown with React components.

Adding a New Post

  1. Create a new .mdx file in app/posts/_articles/
  2. Add metadata at the top:
export const metadata = {
  title: 'Your Post Title',
  description: 'A brief description',
  date: '2025.01.01',
  tags: ['Tag1', 'Tag2'],
}

Your content here...
  1. The post will automatically:
    • Appear in the posts index
    • Be included in RSS feed
    • Be filterable by tags
    • Get a URL like /posts/your-post-title

Content Sections

  • Posts (app/posts/_articles/) - Blog posts and articles
  • Notes (app/notes/_articles/) - Reading notes and summaries
  • Misc (app/misc/_articles/) - Miscellaneous content

All sections follow the same structure and metadata format.

Gallery

The gallery feature displays a collection of photography. Photos are managed in app/gallery/data.ts.

To add a new photo:

  1. Upload the image to a hosting service (e.g., Cloudflare R2).
  2. Add a new object to the photos array in app/gallery/data.ts:
{
  id: 'unique-id',
  src: 'https://your-image-url.jpg',
  alt: 'Description for accessibility',
  caption: 'Optional caption text',
  metadata: {
    'Location': 'Kyoto, Japan',
    'Date': '2024-10-28',
    'Camera': 'Sony ฮฑ7C II',
  }
}

Using Components

MDX files can use React components:

<Card
  image="https://example.com/image.jpg"
  title="Card Title"
  desc="Description"
  link="https://example.com"
/>

<BlockSideTitle title="Side note text">
  Main content here
</BlockSideTitle>

Customization

Colors

The blog uses the "rurikon" color palette defined in app/globals.css. Customize colors by modifying the @theme section.

Fonts

Custom fonts are loaded from app/_fonts/. To change fonts, replace the font files and update app/layout.tsx.

Navigation

Edit components/navbar.tsx to modify navigation links.

Deployment

The blog uses automated CI/CD with GitHub Actions and Cloudflare Pages.

Quick Deploy

# Deploy to preview
npm run deploy

# Deploy to production
npm run deploy:prod

Automatic Deployments

  • Push to v2 branch โ†’ Preview deployment
  • Push to main branch โ†’ Production deployment

See DEPLOYMENT.md for detailed setup instructions.

Tag System

Using Tags

Add tags to any article's metadata:

export const metadata = {
  title: 'My Post',
  tags: ['JavaScript', 'React', 'Web Development'],
}

Viewing Tags

  • Browse all tags: /tags/all
  • Filter by tags: /tags/all?tag=JavaScript
  • Click tags on articles to filter

RSS Feed

The RSS feed is automatically generated on every build:

  • Feed URL: https://linghao.io/feed.xml
  • Includes: All posts, notes, and misc articles
  • Updates: Automatic on deployment
  • Manual generation: npm run rss

License

MIT

Acknowledgments

This blog is inspired by Shu Ding's blog.

About

Personal blog built with Next.js and MDX

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •