303 border-radius: 9999px;
304 transition-property: color, background-color;
305 transition-timing-function: ease-in-out;
306 transition-duration: 200ms;
307}
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2
3export function RSSIcon (props: React.SVGProps<SVGSVGElement>) {
4 return (
5 <svg
24}
25
26export function TwitterIcon (props: React.SVGProps<SVGSVGElement>) {
27 return (
28 <svg
41}
42
43export function GitHubIcon (props: React.SVGProps<SVGSVGElement>) {
44 return (
45 <svg
59}
60
61export function BlueskyIcon (props: React.SVGProps<SVGSVGElement>) {
62 return (
63 <svg
75}
76
77export function DiscordIcon (props: React.SVGProps<SVGSVGElement>) {
78 return (
79 <svg
5import Byline from "./Byline.tsx";
6
7export function HomePage({ posts }: { posts: BlogPost[] }) {
8 const latest = posts.at(0);
9 const top = posts.slice(1, 3);
7const HLJS_CSS_URL = "https://cdn.jsdelivr.net/npm/highlight.js@11.8.0/styles/base16/solar-flare-light.css";
8
9export default function Head({ title, post }: {
10 title: string;
11 post?: BlogPost;
4
5// Get all blog posts (local + RSS)
6export async function getAllBlogPosts(): Promise<BlogPost[]> {
7 return (await Promise.all([
8 getNewPosts(),
4const OLD_BLOG_RSS = "https://val-town-blog.pages.dev/rss.xml";
5// Get blog posts from RSS feed
6async function getOldPosts(): Promise<BlogPost[]> {
7 const parser = new RssParser();
8 const feed = await parser.parseURL(OLD_BLOG_RSS);
289 "slug": "deprecating-the-run-api",
290 "link": "/blog/deprecating-the-run-api",
291 "description": "Not every function should be an API",
292 "pubDate": "Wed, 07 Feb 2024 00:00:00 GMT",
293 "author": "André Terron",
5
6// Get all blog posts from the file system
7export async function getNewPosts(): Promise<BlogPost[]> {
8 const files = await listFiles(import.meta.url);
9 const blogPostFiles = files.filter(
42
43// Get a single blog post by slug
44export async function getBlogPostBySlug(slug: string): Promise<BlogPost | null> {
45 const post = posts.find(post => post.slug.includes(slug));
46 return post;
5const year = new Date().getFullYear();
6
7export default function Footer () {
8 return (
9 <footer className="container">
21
22```typescript
23function hello() {
24 console.log("Hello, Val Town!");
25}
2import { formatDate, dayOfWeek } from "./util.tsx";
3
4export default function Byline ({ post }: {
5 post: {
6 author: string;
A helper function to build a file's email
Simple functional CSS library for Val Town
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",