
Public
Like
original-vt-blog
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v111View latest version
title: | Migrating the Val Town Blog |
---|---|
description: | How we migrated the Val Town Blog from Astro and Cloudflare Pages to be hosted directly on Val Town. |
pubDate: | 2025-03-30T00:00:00.000Z |
author: | Val Town Team |
We recently migrated the Val Town Blog from Astro and Cloudflare Pages to be hosted directly on Val Town. This post explains the migration process and the architecture of the new blog system.
Previously, our blog was:
- Built with Astro, a modern static site generator
- Deployed to Cloudflare Pages
- Updated through a Git-based workflow
While this setup worked well, we wanted to dogfood our own product and host the blog directly on Val Town.
The new blog system:
- Hosts new blog posts directly on Val Town as markdown files
- Proxies requests for old blog posts to the original Cloudflare Pages deployment
- Constructs the homepage by combining posts from both sources
We implemented the new blog system using:
- React for rendering components
- Tailwind CSS for styling
- Unified/Remark/Rehype for markdown processing
- RSS Parser for fetching posts from the old blog
// Example of how we fetch blog posts
async function getAllBlogPosts() {
// Get local posts from markdown files
const localPosts = await getLocalBlogPosts();
// Get posts from RSS feed
const rssPosts = await getRssBlogPosts();
// Merge and sort by date
return [...localPosts, ...rssPosts].sort((a, b) => {
return new Date(b.pubDate).getTime() - new Date(a.pubDate).getTime();
});
}
- Simplified workflow: We can add new posts directly in Val Town
- Better integration: The blog is now part of our product ecosystem
- Improved performance: We can optimize the delivery of blog content
- Dogfooding: We're using our own product for our content
This migration demonstrates how Val Town can be used to host and serve content while maintaining compatibility with existing systems. We're excited to continue improving the blog and adding new features in the future.