Building a Personal Tech Blog from Scratch

作者:

在

Many developers want a personal tech blog but stall for months on “which framework to pick.” This article offers a complete path to building a personal tech blog from scratch—selection, local setup, deployment, and launch—in a single weekend.

1. Ask Three Questions Before Choosing

Before selecting, ask yourself three questions whose answers determine the technical path:

  1. Can you write code? Yes: pick a static generator; no: pick a hosted solution.
  2. Do you need a backend? No: go static first; if you need comments/admin: use a CMS.
  3. Does SEO matter? Important: must use static generation or SSR.

Mainstream Options Compared

Option Stack Best for
Astro Static-first + Islands Code-capable, SEO-focused
VitePress Vue + Markdown Docs sites / minimal blogs
Hugo Go + templates Speed and simplicity
WordPress PHP + themes No-code, wants an admin panel

Below we use Astro as the example because it balances performance, SEO, and developer experience.

2. Local Setup

Make sure Node.js 18+ is installed, then run:

# Create the project
npm create astro@latest my-blog
# Pick recommended options: TypeScript strict, Empty template

cd my-blog
npm install
npm run dev    # Local preview at http://localhost:4321

Adding a Markdown article:

# Install MD integration
npx astro add mdx
# Create a new article
# src/content/blog/hello.md
---
title: 'My First Post'
pubDate: 2026-09-15
description: 'From scratch'
---
Hello, world.

Using content collections to manage articles validates frontmatter at build time, so you catch missing fields before going live.

3. Deploy to a CDN

The most cost-effective deployment for a static site is hosting on Cloudflare Pages / Vercel / Netlify—all free and bundled with a CDN.

  1. Push code to GitHub.
  2. Connect the repo in Cloudflare Pages.
  3. Set build command to npm run build and output directory to dist.
  4. Every push auto-builds and deploys.

Custom domains and HTTPS are configured automatically for free.

4. SEO and Subscriptions

  • Sitemap: Install @astrojs/sitemap to auto-generate a site map.
  • RSS: Install @astrojs/rss for a subscription entry for readers.
  • Structured data: Add JSON-LD Article schema in the article template to improve search presentation.
  • Open Graph: Pair each article with an og image for nicer social sharing.

5. Writing Workflow

An efficient writing-to-publish flow:

1. Write Markdown locally
2. git commit & push
3. CDN auto-builds
4. Live + auto-generated sitemap/RSS
5. Submit to search console
6. Share to social platforms

No server, no database—just a Git repo.

6. Common Pitfalls

  • Images too large: Compress to under 200KB before uploading, or use a CDN’s image optimization.
  • Chinese URLs: Use English or numeric slugs to avoid encoding issues.
  • Build timeout: With 100+ articles, enable incremental builds or pagination.
  • Comment system: Use Giscus or utterances, no backend needed.

7. Summary

A personal tech blog is essentially a content-publishing pipeline managed by Git. Once you pick the right static generator, the rest is continuous output. Don’t burn time on selection—Astro covers 90% of cases. Don’t wait for a “perfect design”—launch first, iterate later. Don’t chase feature completeness; the writing experience and load speed are a blog’s lifeline. Get it running first, then optimize.

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注