ChanKay Blog
DemosTechnicalTrading
English简体中文
English简体中文
DemosTechnicalTrading
ChanKay Blog
GitHubBilibiliWeChat
Privacy PolicyAboutContact

© 2026 ChanKay Blog

Bringing four old demos back to my blog

Nov 26, 2026•4 min read

Opening a demo used to take readers to a separate subdomain with its own navigation. I brought four older demos under one address and gave them the blog’s header and footer while keeping each repository independently deployable.

There are four cards on my blog’s /demos page: Bézier, Tetris, LangBridge, and Easy2GIF. They’re demos I built a while back. Each card used to take you to the project’s own subdomain. I could change the navigation icon on the blog, click through to one of those pages, and see the old one again.

I wanted to bring those pages under demos.chankay.com and give them the blog’s header and footer. I also wanted to keep their repositories. If I ever felt like changing a keyboard control in Tetris, I could still open its repo and ship just the game.

One entry point for four repositories

Some of the demos lived on Workers and the others on Pages. One option was to give each repository its own Worker. But each deployment had much the same job: the browser asked for a page, and the server sent back files that were already built. The files needed separate homes. A single service could serve all of them.

All four builds produce static files. GitHub Actions could build each project in its own repository and upload the output directly to its own prefix in R2. One Worker could serve them all by reading the first segment of the URL. That put /tetris/ next to /bezier/ without tying their release schedules together.

The two paths in the diagram meet when someone opens the page. The keyboard control travels with the Tetris build. The navigation comes from the blog. A shared component package would have saved me from writing the header four times, but I’d still be waiting for four builds to pick up the new icon. That was the reason to assemble the page at request time.

How we share one page layout across all sites

When you open a demo, the Worker reads its entry HTML from R2. There’s a slot at the top and one at the bottom. The blog supplies a header and footer for the requested language, and the Worker fills both slots before sending the page. You can already follow the Technical link back to the blog while the game script is downloading.

I thought we had shared the navigation at that point. Then I opened LangBridge on a desktop. The footer sat in a centered column, as it would on a phone. In dark mode, the black logo all but disappeared. The HTML was the same, but the result still depended on which CSS happened to ship with LangBridge.

That gave shell.css a concrete job. It owns the breakpoint that turns the footer into a row, the visibility of the theme control, and the logo color against a dark background. The shell uses the blog’s color tokens. Tetris still gets to choose its block colors, and LangBridge still gets to highlight code its own way.

What to do when the shared layout fails to load

Sometimes the first visit showed a stripped-down menu. Reload, and the missing links came back. The edge location serving that first visit had an empty cache. When the blog took too long to return its fragments, the Worker used its built-in navigation. Another location might have fetched a perfectly good header a moment earlier.

I’d rather see yesterday’s menu for a little longer than watch most of it disappear. We now keep the last validated header and footer together in R2. If the blog times out, the Worker can use a snapshot for the same language and shell version in the response already underway. The minimal shell is there for the case where even that copy is missing. A failed or partial refresh can’t overwrite the good copy.

Moving the four demos to one domain

We moved Bézier first, followed by Tetris, LangBridge, and Easy2GIF. Between them and Bézier there were seven public pages to check, including language pages and deep links. We tested the new addresses, checked that old links kept their paths and query strings, and left permanent redirects in place.

If I add another demo, I can start from the GitHub template, grant the repository permission to publish, and register the project once in Payload. The directory, gateway, and sitemap all read that record. The next time I change the blog logo, the edit can reach these old demos even if their repositories haven’t seen a new commit in years.

Discussion

Sign in with GitHub to comment. All language versions share this discussion.

View discussions on GitHub

On this page

  • One entry point for four repositories
  • How we share one page layout across all sites
  • What to do when the shared layout fails to load
  • Moving the four demos to one domain