Skip to content

Building and Deploying a Site

“Build me a landing page / tool site / blog.” The hard part isn’t writing code — it’s getting something reachable at a URL.

Need Recommendation
Content sites, blogs, docs, tutorials Static site generator (Astro / Next.js)
Interactive tools, small games Frontend framework + static hosting
Database and auth Full-stack framework + managed database

Prefer static for content sites — fast, SEO-friendly, free to host.

With Astro:

终端窗口
npm create astro@latest my-site -- --template starlight --install --no-git --yes
终端窗口
npm run dev

Focus on functionality and content here. Don’t polish pixels yet.

终端窗口
npm run build

A clean build is the floor. Then smoke test:

  • Does the homepage load?
  • Do key pages return 200?
  • Does navigation work?

Quick check:

终端窗口
for u in / /about/ /pricing/; do
echo -n "$u -> "
curl -s -o /dev/null -w "%{http_code}\n" "http://localhost:4321$u"
done

Don’t loop over screenshot verification for visual details. Function first; visual issues are faster to catch by eye in a real browser.

Static sites can be published to a live link directly:

Publish this project as an online link

You’ll get a shareable URL.

Bind your domain on the hosting platform and add the DNS record (usually CNAME).

Three things after launch:

  1. Submit your sitemap to search console / webmaster tools
  2. Wire up analytics
  3. Verify the SEO trio: sitemap, canonical, hreflang (for multilingual sites)

npm commands get blocked

终端窗口
# On CODEBUDDY_BROKER_DENY:
env -u NODE_OPTIONS npm install
env -u NODE_OPTIONS npm run build

NODE_OPTIONS has a shim injected. Independent of which node version you use — it’s the variable.

Also expect permission prompts on first write; allow always.

For a bilingual site:

src/content/docs/
├── index.mdx # default language (root /)
├── getting-started/
└── en/ # English at /en/
├── index.mdx
└── getting-started/

Once configured, hreflang and canonical generate automatically. Every page needs its counterpart — missing ones render as untranslated placeholders.

  • Build with no errors
  • All key pages return 200
  • Mobile layout holds up
  • Site title and description aren’t defaults
  • Sitemap is reachable
  • Analytics installed
  • DNS resolved (if using a domain)

The Content Automation Pipeline.