跳到正文
ygao.io
主页文章

分类

  • 全部
  • Site notes

2026-11-24 · Site notes

One build, two hostnames

How a Markdown file becomes a page on blog.ygao.io.

The homepage at ygao.io and the blog at blog.ygao.io share an Astro project. A single build produces the homepage, the post index, and a page for each article.

From Markdown to a URL

This post lives in src/content/posts/building-this-site.md. Astro reads its title, description, and date to build the index. The filename supplies the URL, /posts/building-this-site/.

Serving the blog index

Both hostnames point to one Cloudflare Pages project. When a reader opens the root of the blog, Cloudflare serves the index from /blog/ and keeps blog.ygao.io/ in the address bar.

OpenTofu describes the DNS records, domain bindings, and rewrite rule. Publishing a new article only requires rebuilding and uploading the site.

[ 全部文章 ]
GitHub·Print