
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: v37View latest version
The Val Town Blog has undergone a migration from its original hosting on Astro and Cloudflare Pages to being hosted directly on Val Town. This repository contains the code that powers the current blog implementation.
- New Posts: New blog posts are rendered directly from Val Town using markdown files
- Legacy Posts: For older blog posts, we proxy requests to the original blog hosted at Cloudflare Pages
- Homepage: The homepage is dynamically constructed by:
- Parsing the RSS feed from the old blog at
https://val-town-blog.pages.dev/rss.xml
- Injecting new posts hosted on Val Town into the feed
- Rendering the combined content with a consistent design
- Parsing the RSS feed from the old blog at
/index.tsx
: Main entry point that handles routing and proxying/components/HomePage.tsx
: Renders the blog homepage with the list of posts/components/BlogPostTemplate.tsx
: Template for rendering individual blog posts/components/BlogPosts.ts
: Manages the list of new blog posts and merging with RSS feed/components/MarkdownRenderer.ts
: Simple utility to convert markdown to HTML/blog-posts/
: Directory containing markdown files for new blog posts
The main index.tsx
file handles proxying requests to the old blog when necessary. When a user visits a URL that corresponds to an old blog post, the request is forwarded to the original Cloudflare Pages deployment.
To add a new blog post to the Val Town Blog:
-
Create a markdown file in the
/blog-posts
directory with the post content- Example:
/blog-posts/my-new-post.md
- Example:
-
Add the post metadata to the
newBlogPosts
array in/components/BlogPosts.ts
:{ title: "My New Blog Post", link: "/blog/my-new-post", description: "A brief description of the post", pubDate: "Fri, 29 Mar 2025 00:00:00 GMT", author: "Author Name" } -
The post will automatically appear on the homepage and be accessible at the specified link
- The old blog URL is:
https://val-town-blog.pages.dev/
- New blog posts are stored as markdown files and rendered on-demand
- The homepage fetches and parses the RSS feed from the old blog
- The system uses React for rendering both the homepage and individual blog posts
- No external dependencies are required for markdown parsing or RSS handling
When modifying the blog system:
- Update the components in the
/components
directory - Test changes by visiting the homepage and individual blog posts
- For styling changes, modify the inline CSS in the respective component files
- To change how posts are fetched or merged, update the
fetchBlogPosts
function inHomePage.tsx