A whole quarter has passed without a single blog post, and I’ve been tinkering with all sorts of side stuff instead—feels a bit shameful.
The idea came from wanting to be able to sit down and write without constantly switching between different repos: the blog, the digital garden, and a bunch of more fragmented notes.
How can I manage all this content in one place, and have a pleasant writing environment at the same time?
When I was changing my Obsidian sync setup, I noticed Obsidian’s git plugin, and a thought occurred to me:
If I save everything under astro/content in a single vault, and use that git plugin to commit the content, which then triggers Vercel’s automatic builds, wouldn’t I effectively have an unparalleled desktop content management tool?
As I kept thinking and experimenting, the technical approach gradually became clearer:
- Based on the existing blog project, add the digital garden content and integrate the previous wikilink parsing plugin
- Turn the
contentdirectory in the blog project into an independent repo and integrate it into the main project as a submodule - Use GitHub Actions so that when the content project is updated, the blog project is automatically updated and triggers the main project build
Migrating the digital garden
How do I bind the digital garden, which was previously on Starlight, into the blog project?
First I tried integrating Starlight with the least possible amount of work. Technically it worked fine: just configure the routes and the project runs. Navigation even felt a bit faster. But the stylistic differences between the two pages really bothered me. Even with GitHub - HiDeoo/starlight-theme-rapide: Starlight theme inspired by the Visual Studio Code Vitesse theme, switching themes still felt very jarring.
I tried rewriting part of the components, but eventually realized my skills weren’t up to achieving the look I wanted in a few areas, so I had to look for another approach.
Going further, I simply abandoned Starlight and rewrote that part with Astro itself. While doing it, I realized that if the goal is just to display the content and give it a rough directory tree, the workload actually isn’t that big. I’d already implemented wikilink parsing before. The only real obstacle I ran into was Routing too many redirects when using the config.json file generated by the Vercel adapter · Issue #418 · withastro/adapters · GitHub, but if you’re not obsessive about perfection, it’s not really a problem.
Triggering builds on content updates
- In the blog project: yuhang.ch/.github/workflows/update-content.yml at main · yuhangch/yuhang.ch · GitHub
- In the content project: content/.github/workflows/deploy.yml at main · yuhangch/content · GitHub
Both of these scripts were written by GPT. All the pitfalls I hit were basically about how GitHub Token permissions are assigned. Some of it is recorded in 自动更新submodule.
Finally
While updating this part, I also took the chance to use some of Astro’s new features, like astro:env and getCollection. Since there’s been no sensitive information in the project from creation to completion, I’ve set both repos to public.
As for when these changes will be synced to GitHub - yuhangch/astro-theme-panda: A tiny blog theme for astro., that’ll probably have to wait until I have some free time again.