Under construction: I’m still building this website — content and layout may change.

See projects
Skip to content

How to add content (posts, projects, images, code)

A quick guide for adding new posts/projects, plus images and code blocks.

Published 2026-01-11 Updated 2026-01-11

This is a quick, practical checklist for adding content to this site.

Placeholder banner image

1) Create a post or project

Use the generator scripts when possible (they apply the template and frontmatter).

Post

npm run new:post my-post-slug

Project

npm run new:project my-project-slug

2) Add images

There are two approaches: “simple” (just copy a file) or “optimized” (Astro image pipeline).

Option A (simple): serve from public/

  1. Put files under public/, for example:
  1. Reference them from MDX with a plain <img>:
<img src="/images/my-post/diagram.png" alt="Diagram" />

Example (rendered below):

Diagram

This works because anything in public/ is served from the site root.

Option B (optimized): import from src/assets/

Use this when you want Astro’s <Image /> optimization (formats like WebP, responsive sizing, etc.).

---
import { Image } from 'astro:assets';
import figure from '../../assets/profile-placeholder.png';
---

<Image src={figure} alt="Example image" width={800} format="webp" />

Notes:

3) Add code snippets

Code blocks

Use fenced code blocks:

export function hello(name: string) {
  return `Hello, ${name}`;
}

Inline code

Use backticks for short commands/config keys: npm run build.

4) Island demo (Preact + React-compat)

This section is a reference example: how to embed a small interactive “island” in an otherwise static MDX post.

Island demo

Server-only component + a hydrated counter. The counter uses client:visible.

Server-rendered: Hello, from an MDX blog post.

no hydration
Counter
Count: 0
hydrates on visible
What’s happening here?
  • ServerOnlyHello is server-rendered (no hydration, no shipped JS).
  • CounterIsland hydrates when it becomes visible (client:visible).
  • The site uses Preact for islands, with react aliased to preact/compat so shadcn components can coexist.

5) Publish checklist

Before publishing:

npm run dev
npm run build