Home About Me

Rebuilding My Blog Pipeline: Automation Up Front, Routing Trouble Downstream

Over the past few months I've been picking away at both the publishing side of my blog and the path visitors take to reach it. Neither looks the way it did before, so here's what changed and what it cost me.

Publishing

Markdown editor feeding into the publishing script

Everything still starts in a Markdown editor. When a draft is ready, I run a single script — one I got out of DeepSeek Chat after describing what I needed and letting it write the code. That script does five things:

  • collects every image referenced in the post into one folder and renames them
  • sends them through the TinyJPG API for compression
  • drops the folder into my local image library
  • syncs that library to an S3-compatible bucket with Rclone, which is how the images actually get published
  • writes a new Markdown file in which each image reference points at its final URL

From there I commit the Markdown to a private GitHub repo by hand, and CI/CD turns it into static pages. Upyun deployments go out through Buddy, using Upyun's own upx tool; Cloudflare Pages simply builds from the commands configured on its side.

The path from draft to live post is much shorter now, and most of the tedious work happens on its own, which is exactly what I wanted from this.

Routing visitors

DNS-based split between domestic and overseas backends

The blog no longer depends on any single provider. Static pages and the image host both sit behind DNS-based splitting, so swapping a backend is a matter of changing records. The image host only has to speak S3 — there are plenty of static hosting and object storage services in China and abroad, and their free tiers are more than enough for a small personal site.

It isn't flawless, though. Splitting brought a new headache: Cloudflare Pages permanently redirects .html URLs to the extension-less form, so overseas search engines have ended up indexing links without the suffix. DNS-based splitting can't pin down a visitor's location with complete accuracy either, and Bing keeps separate indexes for China and the rest of the world. The visitor adds yet another variable. Someone in China searching on Google follows rules that hand back extension-less links; DNSPod decides they're domestic; the request lands on Upyun; and because I hadn't configured any CDN edge rules, they get a 404.

404 caused by the missing suffix

The fix was a rule on the Upyun CDN that redirects extension-less requests to the .html version:

$WHEN($MATCH($_URI,'^([^.]+)([^/])$'))$REDIRECT(https://blog.yasking.org$_URI'.html',302)

Which quietly adds a new constraint: any storage or CDN sitting behind the blog now has to serve both the suffixed and unsuffixed paths.

A tactical misstep or two, but the strategy held up.