A personal blog built with Astro, deployed to GitHub Pages. Posts are authored in Markdown/MDX and support LaTeX math, syntax highlighting, GFM tables, and interactive React components.
Live site: https://luckylwk.github.io
- Astro with Content Collections (typed frontmatter via Zod)
- remark-math + rehype-katex for LaTeX math (KaTeX CSS bundled locally)
- Shiki (
github-dark) for code syntax highlighting - React + MDX for interactive islands (e.g. charts via
recharts) - GitHub Actions for build & deploy
All commands run from the project root:
| Command | Action |
|---|---|
pnpm install |
Install dependencies |
pnpm run dev |
Start the dev server at localhost:4321 |
pnpm run build |
Build the production site to ./dist/ |
pnpm run preview |
Preview the production build locally |
- Create a file in
src/content/blog/— use.mdfor plain posts or.mdxwhen you need to embed React components. - Add frontmatter matching the schema (see below).
- Write your content. Drafts (
draft: true) are hidden from listings and the production build; publish by setting it tofalse(or removing it).
Defined and type-checked in src/content.config.ts:
| Field | Type | Required | Notes |
|---|---|---|---|
title |
string | yes | Post title. |
description |
string | yes | Used for SEO / Open Graph. |
pubDate |
date | yes | e.g. 'Jul 08 2026'. |
updatedDate |
date | no | Shown as "Last updated on". |
heroImage |
image | no | Path relative to the post, e.g. ../../assets/…. |
tags |
string[] | no | Defaults to []; drives the /tags pages. |
draft |
boolean | no | Defaults to false; true hides the post. |
Example:
---
title: 'My post'
description: 'A one-line summary.'
pubDate: 'Jul 08 2026'
tags: ['guide', 'astro']
draft: false
---Every string listed in a post's tags array automatically appears on:
/tags— an index of all tags with post counts, and/tags/<tag>— a page listing every post with that tag.
No extra configuration is needed; add a tag to a post and the pages regenerate on the next build.
-
Math — inline
$E = mc^2$and display$$ … $$blocks render via KaTeX. -
Code — fenced code blocks are highlighted with the
github-darktheme. -
React islands — in an
.mdxpost, import a component and render it with a client directive:import Counter from '../../components/Counter.jsx'; <Counter client:visible start={3} />
See
src/content/blog/math-and-code.mdxanddata-visualization.mdxfor working examples.
Pushing to main triggers .github/workflows/deploy.yml, which builds the site
with withastro/action and publishes it with actions/deploy-pages. Ensure
Settings → Pages → Source is set to GitHub Actions (one-time setup).
The site and base values live in astro.config.mjs. This site deploys at
the domain root (base: '/'); a project repo would use base: '/<repo-name>'.