Files
cv/docs/design/specs/v2/spec-v2-blog.md
T
dong.nguyen d827bf9b23 feat: resume download, router v7/v8 migrations, spec restructure
- Add resume download button in Hero CTA and Contact section
- Migrate react-router v6→v7 and v7→v8
- Restructure specs: UI specs to specs/ui/, v2 specs to specs/v2/
- Add profile-photo assets (jpg + webp)
- Update AGENTS.md, spec-v2.md index
2026-10-06 14:14:01 +07:00

2.0 KiB

Specification — v2 Blog System

Document: spec-v2-blog.md Version: 0.1.0 Parent: spec-v2.md Priority: P1 Estimate: ~4 hours


Requirement

Blog cho phép viết technical articles bằng Markdown/MDX, render trên client.


Architecture

src/
  content/
    blog/
      post-1.mdx
      post-2.mdx
  components/
    blog/
      BlogListPage.tsx
      BlogPostPage.tsx
      ArticleCard.tsx
      CodeBlock.tsx

Features

Frontmatter

Mỗi article có frontmatter:

---
title: "Building High-Performance Event Simulation with Go"
date: "2024-06-15"
tags: ["engineering", "golang", "simulation"]
summary: "Discrete event simulation for logistics facilities"
---

Blog List Page (/blog)

  • Hiển thị danh sách articles
  • Sort theo date (newest first)
  • Filter theo tags (pill buttons)
  • Mỗi article card: title, date, tags, summary

Article Page (/blog/:slug)

  • Render MDX content
  • Code blocks với syntax highlighting
  • TOC (table of contents) sidebar (desktop)
  • Reading time estimate
  • Breadcrumb navigation

Code Highlighting

  • Dùng rehype-prism-plus hoặc rehype-raw + prismjs
  • Không dùng library nặng như react-syntax-highlighter
  • Theme: dark/light compatible với CSS variables

MDX Processing

  • Dùng @mdx-js/react + @mdx-js/rollup (Vite plugin)
  • Build-time compilation (không runtime)
  • Frontmatter extracted tại build time

Vite Config Changes

import mdx from '@mdx-js/rollup'

export default defineConfig({
  plugins: [
    react(),
    mdx({
      providerImportSource: '@mdx-js/react',
    }),
  ],
})

Acceptance

  • /blog hiển thị danh sách articles
  • Article card có title, date, tags, summary
  • Click article → navigate đến /blog/:slug
  • MDX content render đúng
  • Code blocks có syntax highlighting
  • Tags filter hoạt động
  • TOC sidebar (desktop only)
  • Reading time hiển thị
  • Responsive
  • Không crash khi missing article