How to publish a post

anjeludo anjeludo #meta#astro

The frontmatter this blog expects, and the Markdown features available in a post.

How to publish a post

A post is a folder under src/content/blog/ with an index.md inside. The folder name is the URL: src/content/blog/how-to-publish-a-post/ is served at /blog/how-to-publish-a-post/.

Frontmatter

title, description, date and authors are required; the build fails without them. authors holds references to files in src/content/authors/, by filename without the extension.

tags, image, draft and order are optional. image resolves against the post’s own folder, so ./cover.png sits next to this file.

Note

Unlike Hugo, a future date still publishes. To hide a post, set draft: true.

Code

Fenced blocks get syntax highlighting, a frame and a copy button:

example.ts
export const greet = (name: string): string => `Hello, ${name}`

Inline code can be highlighted too, with the `code{:lang}` annotation: const x = 1.

Shell blocks drop the line numbers:

Terminal window
docker compose run --rm --no-deps build

Callouts

Five variants: note, tip, warning, caution and important. Add {closed} to render one collapsed.

Tip

Callouts are <details> elements, so they are open by default and the reader can fold them away.

Warning

This one starts collapsed.

Math

Inline math like eiπ=1, and display math:

0ex2dx=π2

It renders to native MathML through Temml, so there is no client-side layout step.

Images

The cover image of this post