Skip to content
Content / Writing content

Content

Writing content

How to add blog posts, projects, and docs pages with typed frontmatter.

Blog posts

Add a .md or .mdx file to src/content/blog/. The filename becomes the URL slug.

src/content/blog/my-post.md
---
title: 'My new post'
description: 'One or two sentences used in cards, SEO, and the RSS feed.'
publishedAt: 2026-08-01
tags: ['TypeScript', 'Web']
category: 'Engineering'
image: './images/my-post.png' # optional cover
featured: false
draft: false
---
Your content here.

Schema notes:

  • publishedAt is required; updatedAt is optional and shown when present
  • featured: true surfaces the post on the homepage
  • draft: true hides the post from production builds but keeps it visible in dev
  • image (optional) is the cover. See Images below
  • Reading time is computed automatically, nothing to declare

Images

Put images next to your content and reference them with a relative path. The build resizes them, converts them to WebP, and emits a srcset, so a 2MB screenshot never reaches a visitor:

src/content/
├── blog/
│ ├── my-post.mdx
│ └── images/my-post.png ← image: './images/my-post.png'
└── projects/
├── my-tool.md
└── images/my-tool.png ← image: './images/my-tool.png'
  • Blog image is the cover at the top of the post and the social (Open Graph) image. Aim for 1400×740 or any ~1.9:1 crop.
  • Project image is the card thumbnail and the hero on the project page. Use 16:9 (e.g. 1280×720).
  • Images inside the markdown body (![alt](./images/diagram.png)) are optimized the same way.
  • Animated GIFs and SVGs are passed through untouched.

Files in public/ are served as-is with no optimization. Use that folder only for the favicon and avatar.

Open Graph images

Every post and project gets a generated 1200×630 social card at build time (title, description, category, and your site name on the dark theme), served from /og/blog/<slug>.png and /og/projects/<slug>.png. Pages without their own card (home, about, docs) use /og/default.png, built from your hero tagline.

A post or project that sets image uses that image for social previews instead. Change the design in src/lib/og.ts.

Projects

Add a file to src/content/projects/:

src/content/projects/my-tool.md
---
title: 'My Tool'
description: 'What it is, in one sentence.'
image: './images/my-tool.png'
technologies: ['TypeScript', 'Node.js']
github: 'https://github.com/you/my-tool'
demo: 'https://my-tool.example.com'
status: 'active' # active | maintained | archived | in-progress
year: 2026
featured: true
---
## Overview
...

The body supports the same markdown features as blog posts. A common structure: Overview → Technology stack → Challenges → Results.

Docs pages

Add files to src/content/docs/. Sidebar structure comes from frontmatter, not folders:

---
title: 'My guide'
group: 'Guides' # sidebar section heading
order: 30 # position (sorted ascending, globally)
---

Subfolders are fine and become part of the URL (docs/customization/theming.md → /docs/customization/theming).

MDX

Use the .mdx extension when you need components. Callout and Tabs are pre-wired in all three collections, no imports needed:

<Callout type="warning">Careful with this one.</Callout>
<Tabs tabs={['npm', 'pnpm']}>
<div>
```bash
npm install astro
Terminal window
pnpm add astro
```

Keep the blank lines around fenced code inside <Tabs>. MDX needs them to switch back to markdown mode.

External links in content (https://…) automatically open in a new tab with rel="noopener noreferrer". Internal links stay root-relative (/blog/my-post) and are rewritten for subpath deploys at build time. Both are handled by the markdown pipeline in astro.config.ts.

Drafts

Set draft: true on any post, project, or doc. Drafts render in npm run dev so you can preview them, and are excluded from npm run build.

↑↓ navigate↵ openesc close